Skip to content

Commit 0301a58

Browse files
committed
Change to filtering using desc. where desc. is the channel index
1 parent 21d75a3 commit 0301a58

4 files changed

Lines changed: 20 additions & 13 deletions

File tree

Plugins/LfpDisplayNode/DisplayBuffer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ DisplayBuffer::DisplayBuffer(int id_, String name_, float sampleRate_) :
4141
}
4242

4343
ttlState = 0;
44-
filteredChannels = StringArray();
4544
}
4645

4746
DisplayBuffer::~DisplayBuffer()
@@ -65,7 +64,8 @@ void DisplayBuffer::addChannel(
6564
ContinuousChannel::Type type,
6665
bool isRecorded,
6766
int group,
68-
float ypos,
67+
float ypos,
68+
String description,
6969
String structure)
7070
{
7171
ChannelMetadata metadata = ChannelMetadata();
@@ -76,6 +76,7 @@ void DisplayBuffer::addChannel(
7676
metadata.structure = structure;
7777
metadata.type = type;
7878
metadata.isRecorded = isRecorded;
79+
metadata.description = description;
7980

8081
channelMetadata.add(metadata);
8182
channelMap[channelNum] = numChannels;

Plugins/LfpDisplayNode/DisplayBuffer.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ namespace LfpViewer {
6060
ContinuousChannel::Type channelType,
6161
bool isRecorded,
6262
int group = 0,
63-
float ypos = 0,
63+
float ypos = 0,
64+
String description = "",
6465
String structure = "None");
6566

6667
/** Initializes the event channel at the start of each buffer */
@@ -87,11 +88,12 @@ namespace LfpViewer {
8788
String structure = "None";
8889
ContinuousChannel::Type type;
8990
bool isRecorded = false;
91+
String description = "";
9092
};
9193

9294
Array<ChannelMetadata> channelMetadata;
9395

94-
void setFilteredChannels(StringArray channels) {filteredChannels = channels;}
96+
void setFilteredChannels(Array<int> channels) {filteredChannels = channels;}
9597

9698
String name;
9799
int id;
@@ -126,7 +128,7 @@ namespace LfpViewer {
126128

127129
Array<int> displays;
128130

129-
StringArray filteredChannels;
131+
Array<int> filteredChannels;
130132

131133
};
132134
};

Plugins/LfpDisplayNode/LfpDisplay.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -981,17 +981,20 @@ void LfpDisplay::rebuildDrawableChannelsList()
981981
removeAllChildren(); // start with clean slate
982982

983983
Array<LfpChannelTrack> channelsToDraw; // all visible channels will be added to this array
984-
StringArray filteredChannels;
984+
Array<int> filteredChannels;
985985
if(canvasSplit -> displayBuffer) {
986986
filteredChannels = canvasSplit -> displayBuffer -> filteredChannels;
987987
}
988988
// iterate over all channels and select drawable ones
989989
for (int i = 0, drawableChannelNum = 0, filterChannelIndex = 0; i < channels.size(); i++)
990990
{
991991
//std::cout << "Checking for hidden channels" << std::endl;
992-
String channelName = filteredChannels.size() ? canvasSplit->displayBuffer->channelMetadata[i].name: "";
993-
//check if no filter list is used or if the current channel has the same name as the current filtered channel in the list
994-
if(filteredChannels.size() == 0 || (filterChannelIndex < filteredChannels.size() && channelName == filteredChannels[filterChannelIndex])) {
992+
int channelNumber = filteredChannels.size() ? canvasSplit->displayBuffer->channelMetadata[i].description.getIntValue(): -1;
993+
//the filter list can have channels that aren't selected for acqusition; this skips those filtered channels
994+
while(filterChannelIndex < filteredChannels.size() && channelNumber > filteredChannels[filterChannelIndex]){
995+
filterChannelIndex++;
996+
}
997+
if(filteredChannels.size() == 0 || (filterChannelIndex < filteredChannels.size() && channelNumber == filteredChannels[filterChannelIndex])) {
995998
if (displaySkipAmt == 0 || ((filteredChannels.size() ? filterChannelIndex : i) % displaySkipAmt == 0)) // no skips, add all channels
996999
{
9971000

Plugins/LfpDisplayNode/LfpDisplayNode.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,14 @@ void LfpDisplayNode::updateSettings()
9191
displayBufferMap[streamId]->sampleRate = channel->getSampleRate();
9292
displayBufferMap[streamId]->name = name;
9393
}
94-
94+
//
9595
displayBufferMap[streamId]->addChannel(channel->getName(), // name
9696
ch, // index
9797
channel->getChannelType(), // type
9898
channel->isRecorded,
9999
0, // group
100-
channel->position.y // ypos
100+
channel->position.y, // ypos
101+
channel-> getDescription()
101102
);
102103
}
103104

@@ -347,10 +348,10 @@ void LfpDisplayNode::handleBroadcastMessage(String msg) {
347348
if(streamID < 0 || start < 0 || rows < 0 || cols < 0 || colsPerRow < 0){
348349
return;
349350
}
350-
StringArray channelNames;
351+
Array<int> channelNames;
351352
for(int row = 0; row < rows; row++) {
352353
for(int col = 0; col < cols; col++) {
353-
channelNames.add("CH"+String(start + col + row*colsPerRow));
354+
channelNames.add(start + col + row*colsPerRow);
354355
}
355356
}
356357
displayBufferMap[streamID] -> setFilteredChannels(channelNames);

0 commit comments

Comments
 (0)