-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ffb622e
commit 30a3c9c
Showing
8 changed files
with
559 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/*************************************************************************** | ||
cerebusclustersprovider.cpp - description | ||
------------------- | ||
copyright : (C) 2015 by Florian Franzen | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 3 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "cerebusclustersprovider.h" | ||
|
||
#include <QDebug> | ||
|
||
// 0 = unclassified, 1 - cbMAXUNITS = actual units, 254 = artifact (unit + noise), 255 = background (noise) | ||
const int CerebusClustersProvider::CLUSTER_COUNT = cbMAXUNITS + 3; | ||
|
||
CerebusClustersProvider::CerebusClustersProvider(CerebusTracesProvider* source, unsigned int channel, int samplingRate) : | ||
ClustersProvider(QString("cerebus.%1.clu").arg(channel + 1), samplingRate, cbSdk_TICKS_PER_SECOND, 0), | ||
mDataProvider(source), | ||
mChannel(channel) { | ||
|
||
// Name referes to the group, which can not be zero, because zero is trash group. | ||
this->name = QString::number(mChannel + 1); | ||
this->clusterIds << 0 << 1 << 2 << 3 << 4 << 5 << 254 << 255; | ||
} | ||
|
||
CerebusClustersProvider::~CerebusClustersProvider() { | ||
// Nothing to do here | ||
} | ||
|
||
int CerebusClustersProvider::loadData() { | ||
if (mDataProvider->isInitialized()) | ||
return OPEN_ERROR; | ||
else | ||
return OK; | ||
} | ||
|
||
void CerebusClustersProvider::requestData(long start, long end, QObject* initiator, long /*startTimeInRecordingUnits*/) { | ||
Array<dataType>* data = mDataProvider->getClusterData(mChannel, start, end); | ||
emit dataReady(*data, initiator, this->name); | ||
delete data; | ||
} | ||
|
||
void CerebusClustersProvider::requestNextClusterData(long startTime, long timeFrame, const QList<int> &selectedIds, QObject* initiator, long startTimeInRecordingUnits) { | ||
qDebug() << "requestNextClusterData(...) not supported yet."; | ||
} | ||
|
||
void CerebusClustersProvider::requestPreviousClusterData(long startTime, long timeFrame, QList<int> selectedIds, QObject* initiator, long startTimeInRecordingUnits) { | ||
qDebug() << "requestPreviousClusterData(...) not supported yet."; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/*************************************************************************** | ||
cerebusclustersprovider.h - description | ||
------------------- | ||
copyright : (C) 2015 by Florian Franzen | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 3 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef _NEVCLUSTERSPROVIDER_H_ | ||
#define _NEVCLUSTERSPROVIDER_H_ | ||
|
||
#include "clustersprovider.h" | ||
#include "cerebustraceprovider.h" | ||
|
||
class CerebusClustersProvider : public ClustersProvider { | ||
Q_OBJECT | ||
|
||
public: | ||
static const int CLUSTER_COUNT; | ||
|
||
CerebusClustersProvider(CerebusTracesProvider* source, unsigned int channel, int samplingRate); | ||
~CerebusClustersProvider(); | ||
|
||
/** Loads the event ids and the corresponding spike time. | ||
* @return an loadReturnMessage enum giving the load status | ||
* | ||
* Since data is supplied by CerebusTraceProvider, this is | ||
* just a wrapper around isInitialized() | ||
*/ | ||
virtual int loadData(); | ||
|
||
|
||
/**Triggers the retrieve of the cluster information included in the time interval given by @p startTime and @p endTime. | ||
* @param startTime begining of the time interval from which to retrieve the data in miliseconds. | ||
* @param endTime end of the time interval from which to retrieve the data. | ||
* @param initiator instance requesting the data. | ||
* @param startTimeInRecordingUnits begining of the time interval from which to retrieve the data in recording units. | ||
*/ | ||
virtual void requestData(long startTime, long endTime, QObject* initiator, long startTimeInRecordingUnits); | ||
|
||
|
||
/**Looks up for the first of the clusters included in the list @p selectedIds existing after the time @p startTime. | ||
* All the clusters included in the time interval given by @p timeFrame are retrieved. The time interval start time is | ||
* computed in order to have the first cluster found located at @p clusterPosition percentage of the time interval. | ||
* @param startTime starting time, in miliseconds, for the look up. | ||
* @param timeFrame time interval for which to retrieve the data. | ||
* @param selectedIds list of cluster ids to look up for. | ||
* @param initiator instance requesting the data. | ||
* @param startTimeInRecordingUnits starting time, in recording units, for the look up. | ||
*/ | ||
virtual void requestNextClusterData(long startTime, long timeFrame, const QList<int> &selectedIds, QObject* initiator, long startTimeInRecordingUnits); | ||
|
||
|
||
/**Looks up for the first of the clusters included in the list @p selectedIds existing before the time @p endTime. | ||
* All the clusters included in the time interval given by @p timeFrame are retrieved. The time interval start time is | ||
* computed in order to have the first cluster found located at @p clusterPosition percentage of the time interval. | ||
* @param startTime starting time, in miliseconds, for the look up. | ||
* @param timeFrame time interval for which to retrieve the data. | ||
* @param selectedIds list of cluster ids to look up for. | ||
* @param initiator instance requesting the data. | ||
* @param startTimeInRecordingUnits starting time, in recording units, for the look up. | ||
*/ | ||
virtual void requestPreviousClusterData(long startTime, long timeFrame, QList<int> selectedIds, QObject* initiator, long startTimeInRecordingUnits); | ||
|
||
private: | ||
// The actual data source of the cluster data. | ||
CerebusTracesProvider* mDataProvider; | ||
|
||
// Channel this provider is responsible for | ||
unsigned int mChannel; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.