Skip to content
Snippets Groups Projects
Commit 10e5a30f authored by jsiegle's avatar jsiegle
Browse files

Names of SpikePlots now reflect actual electrode names

parent d77131f9
No related branches found
No related tags found
No related merge requests found
......@@ -443,6 +443,8 @@ void SpikeDetectorEditor::labelTextChanged(Label* label)
electrodeTypes->setText(currentText += "s");
}
getEditorViewport()->makeEditorVisible(this, false, true);
}
void SpikeDetectorEditor::comboBoxChanged(ComboBox* comboBox)
......
......@@ -165,7 +165,7 @@ bool SpikeDetector::addElectrode(int nChans)
float SpikeDetector::getDefaultThreshold()
{
return 75.0f;
return 50.0f;
}
StringArray SpikeDetector::getElectrodeNames()
......
......@@ -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;
......
......@@ -71,7 +71,7 @@ public:
return eventBuffer;
}
String getNameForElectrode(int i);
int getNumberOfChannelsForElectrode(int i);
int getNumElectrodes();
......
......@@ -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();
}
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment