diff --git a/Source/Processors/Editors/SpikeDetectorEditor.cpp b/Source/Processors/Editors/SpikeDetectorEditor.cpp index 20bfdee9d222af90d6e318903483ca9535adf8a0..92ba610036d18777affc392b3acb701230568e03 100755 --- a/Source/Processors/Editors/SpikeDetectorEditor.cpp +++ b/Source/Processors/Editors/SpikeDetectorEditor.cpp @@ -443,6 +443,8 @@ void SpikeDetectorEditor::labelTextChanged(Label* label) electrodeTypes->setText(currentText += "s"); } + getEditorViewport()->makeEditorVisible(this, false, true); + } void SpikeDetectorEditor::comboBoxChanged(ComboBox* comboBox) diff --git a/Source/Processors/SpikeDetector.cpp b/Source/Processors/SpikeDetector.cpp index 1a5025421829e486c36f58e726e6d71872a5ec39..48d8c18b0b77755867ec5bd5ca74e9f0019882e2 100755 --- a/Source/Processors/SpikeDetector.cpp +++ b/Source/Processors/SpikeDetector.cpp @@ -165,7 +165,7 @@ bool SpikeDetector::addElectrode(int nChans) float SpikeDetector::getDefaultThreshold() { - return 75.0f; + return 50.0f; } StringArray SpikeDetector::getElectrodeNames() diff --git a/Source/Processors/SpikeDisplayNode.cpp b/Source/Processors/SpikeDisplayNode.cpp index 161aed18f00c95c9393e388042bb8a21f9a4ac9e..ce983edeb85ae85672f1c696b2821bc06da9e97e 100755 --- a/Source/Processors/SpikeDisplayNode.cpp +++ b/Source/Processors/SpikeDisplayNode.cpp @@ -101,6 +101,28 @@ int SpikeDisplayNode::getNumberOfChannelsForElectrode(int elec) return 0; } +String SpikeDisplayNode::getNameForElectrode(int elec) +{ + + int electrodeIndex = -1; + + for (int i = 0; i < eventChannels.size(); i++) + { + if (eventChannels[i]->eventType < 999) + { + electrodeIndex++; + + if (electrodeIndex == elec) + { + std::cout << "Electrode " << elec << " has " << eventChannels[i]->eventType << " channels" << std::endl; + return eventChannels[i]->name; + } + } + } + + return " "; +} + int SpikeDisplayNode::getNumElectrodes() { int nElectrodes = 0; diff --git a/Source/Processors/SpikeDisplayNode.h b/Source/Processors/SpikeDisplayNode.h index 66dcb85b44be709aece4b795320145063c9c961e..9de5055d33e4d141d33bb3d9abc418f807da3c88 100755 --- a/Source/Processors/SpikeDisplayNode.h +++ b/Source/Processors/SpikeDisplayNode.h @@ -71,7 +71,7 @@ public: return eventBuffer; } - + String getNameForElectrode(int i); int getNumberOfChannelsForElectrode(int i); int getNumElectrodes(); diff --git a/Source/Processors/Visualization/SpikeDisplayCanvas.cpp b/Source/Processors/Visualization/SpikeDisplayCanvas.cpp index 6bc549931f34800a7fdbc9e3289b17e8107db07a..022d0805c6084017873e1e6cb5651165007845e5 100755 --- a/Source/Processors/Visualization/SpikeDisplayCanvas.cpp +++ b/Source/Processors/Visualization/SpikeDisplayCanvas.cpp @@ -79,7 +79,8 @@ void SpikeDisplayCanvas::update() for (int i = 0; i < nPlots; i++) { - spikeDisplay->addSpikePlot(processor->getNumberOfChannelsForElectrode(i), i); + spikeDisplay->addSpikePlot(processor->getNumberOfChannelsForElectrode(i), i, + processor->getNameForElectrode(i)); } spikeDisplay->resized(); @@ -214,12 +215,12 @@ void SpikeDisplay::removePlots() } -void SpikeDisplay::addSpikePlot(int numChannels, int electrodeNum) +void SpikeDisplay::addSpikePlot(int numChannels, int electrodeNum, String name_) { std::cout << "Adding new spike plot." << std::endl; - SpikePlot* spikePlot = new SpikePlot(canvas, electrodeNum, 1000 + numChannels); + SpikePlot* spikePlot = new SpikePlot(canvas, electrodeNum, 1000 + numChannels, name_); spikePlots.add(spikePlot); addAndMakeVisible(spikePlot); } @@ -348,9 +349,9 @@ void SpikeDisplay::plotSpike(const SpikeObject& spike, int electrodeNum) // ---------------------------------------------------------------- -SpikePlot::SpikePlot(SpikeDisplayCanvas* sdc, int elecNum, int p) : +SpikePlot::SpikePlot(SpikeDisplayCanvas* sdc, int elecNum, int p, String name_) : canvas(sdc), isSelected(false), electrodeNumber(elecNum), plotType(p), - limitsChanged(true) + limitsChanged(true), name(name_) { @@ -422,7 +423,7 @@ void SpikePlot::paint(Graphics& g) g.setFont(font); - g.drawText(String(electrodeNumber+1),10,0,50,20,Justification::left,false); + g.drawText(name,10,0,200,20,Justification::left,false); } @@ -430,6 +431,8 @@ void SpikePlot::processSpikeObject(const SpikeObject& s) { //std::cout<<"ElectrodePlot::processSpikeObject()"<<std::endl; + // first, check if it's above threshold + for (int i = 0; i < nWaveAx; i++) wAxes[i]->updateSpikeData(s); @@ -764,7 +767,6 @@ void WaveAxes::updateSpikeData(const SpikeObject& s) spikeBuffer.set(spikeIndex, newSpike); - } void WaveAxes::clear() @@ -844,7 +846,7 @@ void WaveAxes::mouseDrag(const MouseEvent& event) thresholdLevel = (0.5f - thresholdSliderPosition) * range; - std::cout << "Threshold = " << thresholdLevel << std::endl; + //std::cout << "Threshold = " << thresholdLevel << std::endl; repaint(); } diff --git a/Source/Processors/Visualization/SpikeDisplayCanvas.h b/Source/Processors/Visualization/SpikeDisplayCanvas.h index 02ba77143ab868b2840866023d47934bbe1cdad6..4facac441edc43412422f113c64dd38da853853b 100755 --- a/Source/Processors/Visualization/SpikeDisplayCanvas.h +++ b/Source/Processors/Visualization/SpikeDisplayCanvas.h @@ -122,7 +122,7 @@ public: void removePlots(); void clear(); - void addSpikePlot(int numChannels, int electrodeNum); + void addSpikePlot(int numChannels, int electrodeNum, String name); void paint(Graphics& g); @@ -161,12 +161,14 @@ private: Class for drawing the waveforms and projections of incoming spikes. + Also responsible for saving spikes. + */ class SpikePlot : public Component, Button::Listener { public: - SpikePlot(SpikeDisplayCanvas*, int elecNum, int plotType); + SpikePlot(SpikeDisplayCanvas*, int elecNum, int plotType, String name_); virtual ~SpikePlot(); void paint(Graphics& g); @@ -215,6 +217,7 @@ private: void setLimitsOnAxes(); void updateAxesPositions(); + String name; Font font;