@@ -31,12 +31,15 @@ SpikePlot::SpikePlot (SpikeDisplayCanvas* sdc,
3131 int elecNum,
3232 int p,
3333 String name_,
34- std::string identifier_) : canvas (sdc),
35- electrodeNumber (elecNum),
36- plotType (p),
37- limitsChanged (true ),
38- name (name_),
39- identifier (identifier_)
34+ Array<String> continuousChannelNames_,
35+ std::string identifier_) :
36+ canvas (sdc),
37+ electrodeNumber (elecNum),
38+ plotType (p),
39+ limitsChanged (true ),
40+ name (name_),
41+ continuousChannelNames(continuousChannelNames_),
42+ identifier (identifier_)
4043{
4144 font = FontOptions (" Inter" , " Medium" , 16 .0f );
4245
@@ -172,7 +175,7 @@ void SpikePlot::initAxes()
172175
173176 for (int i = 0 ; i < nWaveAx; i++)
174177 {
175- WaveAxes* wAx = new WaveAxes (canvas, electrodeNumber, WAVE1 + i, identifier);
178+ WaveAxes* wAx = new WaveAxes (canvas, electrodeNumber, WAVE1 + i, continuousChannelNames[i], identifier);
176179 waveAxes.add (wAx);
177180 addAndMakeVisible (wAx);
178181 ranges.add (250 .0f ); // default range is 250 microvolts
@@ -181,7 +184,21 @@ void SpikePlot::initAxes()
181184 for (int i = 0 ; i < nProjAx; i++)
182185 {
183186 Projection proj = Projection (int (PROJ1x2) + i);
184- ProjectionAxes* pAx = new ProjectionAxes (canvas, proj);
187+ String channelComparison;
188+ if (i == 0 )
189+ channelComparison = continuousChannelNames[0 ] + " vs " + continuousChannelNames[1 ];
190+ else if (i == 1 )
191+ channelComparison = continuousChannelNames[0 ] + " vs " + continuousChannelNames[2 ];
192+ else if (i == 2 )
193+ channelComparison = continuousChannelNames[0 ] + " vs " + continuousChannelNames[3 ];
194+ else if (i == 3 )
195+ channelComparison = continuousChannelNames[1 ] + " vs " + continuousChannelNames[2 ];
196+ else if (i == 4 )
197+ channelComparison = continuousChannelNames[1 ] + " vs " + continuousChannelNames[3 ];
198+ else if (i == 5 )
199+ channelComparison = continuousChannelNames[2 ] + " vs " + continuousChannelNames[3 ];
200+
201+ ProjectionAxes* pAx = new ProjectionAxes (canvas, proj, channelComparison);
185202 projectionAxes.add (pAx);
186203 addAndMakeVisible (pAx);
187204 }
@@ -458,9 +475,13 @@ void SpikePlot::invertSpikes (bool shouldInvert)
458475 }
459476}
460477
461- GenericAxes::GenericAxes (SpikeDisplayCanvas* canvas, SpikePlotType type_) : canvas (canvas),
462- type (type_),
463- gotFirstSpike (false )
478+ GenericAxes::GenericAxes (SpikeDisplayCanvas* canvas,
479+ SpikePlotType type_,
480+ String channelName_) :
481+ canvas (canvas),
482+ type (type_),
483+ channelName(channelName_),
484+ gotFirstSpike (false )
464485{
465486 ylims[0 ] = 0 ;
466487 ylims[1 ] = 1 ;
@@ -548,21 +569,26 @@ double GenericAxes::ad16ToUv (int x, int gain)
548569 return result;
549570}
550571
551- WaveAxes::WaveAxes (SpikeDisplayCanvas* canvas, int electrodeIndex, int channel_, std::string identifier_) : GenericAxes (canvas, WAVE_AXES),
552- electrodeIndex (electrodeIndex),
553- drawGrid (true ),
554- displayThresholdLevel (0 .0f ),
555- detectorThresholdLevel (0 .0f ),
556- spikesReceivedSinceLastRedraw (0 ),
557- spikeIndex (0 ),
558- bufferSize (5 ),
559- range (250 .0f ),
560- isOverThresholdSlider (false ),
561- isDraggingThresholdSlider (false ),
562- thresholdCoordinator (nullptr ),
563- spikesInverted (false ),
564- channel (channel_),
565- identifier (identifier_)
572+ WaveAxes::WaveAxes (SpikeDisplayCanvas* canvas,
573+ int electrodeIndex,
574+ int channel_,
575+ String channelName,
576+ std::string identifier_) :
577+ GenericAxes (canvas, WAVE_AXES, channelName),
578+ electrodeIndex (electrodeIndex),
579+ drawGrid (true ),
580+ displayThresholdLevel (0 .0f ),
581+ detectorThresholdLevel (0 .0f ),
582+ spikesReceivedSinceLastRedraw (0 ),
583+ spikeIndex (0 ),
584+ bufferSize (5 ),
585+ range (250 .0f ),
586+ isOverThresholdSlider (false ),
587+ isDraggingThresholdSlider (false ),
588+ thresholdCoordinator (nullptr ),
589+ spikesInverted (false ),
590+ channel (channel_),
591+ identifier (identifier_)
566592{
567593 addMouseListener (this , true );
568594
@@ -601,6 +627,11 @@ void WaveAxes::paint (Graphics& g)
601627
602628 // draw the threshold line and labels
603629 drawThresholdSlider (g);
630+
631+ // draw underlying channel name
632+ g.setColour (Colours::white.withAlpha (0 .5f ));
633+ g.setFont (13 );
634+ g.drawText (channelName, getWidth ()-44 , 5 , 40 , 13 , Justification::right);
604635
605636 // if no spikes have been received then don't plot anything
606637 if (! gotFirstSpike)
@@ -612,16 +643,17 @@ void WaveAxes::paint (Graphics& g)
612643 {
613644 if (spikeNum != spikeIndex)
614645 {
615- plotSpike (spikeBuffer[spikeNum], g);
646+ plotSpike (spikeBuffer[spikeNum], g, false );
616647 }
617648 }
618649
619650 plotSpike (spikeBuffer[spikeIndex], g);
620651
621652 spikesReceivedSinceLastRedraw = 0 ;
653+
622654}
623655
624- void WaveAxes::plotSpike (const Spike* s, Graphics& g)
656+ void WaveAxes::plotSpike (const Spike* s, Graphics& g, bool latestSpike )
625657{
626658 if (! s)
627659 return ;
@@ -640,7 +672,13 @@ void WaveAxes::plotSpike (const Spike* s, Graphics& g)
640672 if (s->getSortedId () > 0 )
641673 g.setColour (colours[(s->getSortedId () - 1 ) % 8 ]);
642674 else
643- g.setColour (Colours::white);
675+ {
676+ if (latestSpike)
677+ g.setColour (Colours::white);
678+ else
679+ g.setColour (Colours::white.withAlpha (0 .4f ));
680+ }
681+
644682
645683 // type corresponds to channel so we need to calculate the starting
646684 // sample based upon which channel is getting plotted
@@ -914,12 +952,15 @@ void WaveAxes::setDisplayThreshold (float threshold)
914952
915953// --------------------------------------------------
916954
917- ProjectionAxes::ProjectionAxes (SpikeDisplayCanvas* canvas, Projection proj_) : GenericAxes (canvas, PROJECTION_AXES),
918- imageDim (500 ),
919- rangeX (250 ),
920- rangeY (250 ),
921- spikesReceivedSinceLastRedraw (0 ),
922- proj (proj_)
955+ ProjectionAxes::ProjectionAxes (SpikeDisplayCanvas* canvas,
956+ Projection proj_,
957+ String channelNames) :
958+ GenericAxes (canvas, PROJECTION_AXES, channelNames),
959+ imageDim (500 ),
960+ rangeX (250 ),
961+ rangeY (250 ),
962+ spikesReceivedSinceLastRedraw (0 ),
963+ proj (proj_)
923964{
924965 projectionImage = Image (Image::RGB, imageDim, imageDim, true , SoftwareImageType ());
925966
@@ -947,6 +988,10 @@ void ProjectionAxes::paint (Graphics& g)
947988 imageDim - rangeY,
948989 rangeX,
949990 rangeY);
991+
992+ g.setColour (Colours::white.withAlpha (0 .3f ));
993+ g.setFont (13 );
994+ g.drawText (channelName, 4 , 5 , 100 , 13 , Justification::left);
950995}
951996
952997bool ProjectionAxes::updateSpikeData (const Spike* s)
@@ -1095,4 +1140,4 @@ void MonitorButton::paintButton (Graphics& g, bool isMouseOverButton, bool isBut
10951140 headphoneIcon->drawWithin (g, getLocalBounds ().toFloat (), RectanglePlacement::centred, 1 .0f );
10961141
10971142 headphoneIcon->replaceColour (buttonColour, Colours::black);
1098- }
1143+ }
0 commit comments