diff --git a/Builds/Linux/Makefile b/Builds/Linux/Makefile index 981f776caa43b3bdb8b7dc05a262c3c58c7207d0..3d4b14cdfbec4e3b1a6ce2403585f578992bcfe3 100644 --- a/Builds/Linux/Makefile +++ b/Builds/Linux/Makefile @@ -72,11 +72,9 @@ OBJECTS := \ $(OBJDIR)/ElectrodePlot_7a206ec4.o \ $(OBJDIR)/BaseUIElement_ec903c4d.o \ $(OBJDIR)/GenericAxes_d802ed92.o \ - $(OBJDIR)/Plot_ca16c6f5.o \ $(OBJDIR)/PlotUtils_9ef52686.o \ $(OBJDIR)/ProjectionAxes_7c67c3e8.o \ $(OBJDIR)/TetrodePlot_b42fd798.o \ - $(OBJDIR)/TetrodeSource_612b6d52.o \ $(OBJDIR)/TitleBox_c4a9cde7.o \ $(OBJDIR)/WaveAxes_8adc45d2.o \ $(OBJDIR)/SpikeObject_24e8c655.o \ @@ -294,11 +292,6 @@ $(OBJDIR)/GenericAxes_d802ed92.o: ../../Source/Processors/Visualization/SpikePlo @echo "Compiling GenericAxes.cpp" @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" -$(OBJDIR)/Plot_ca16c6f5.o: ../../Source/Processors/Visualization/SpikePlotting/Plot.cpp - -@mkdir -p $(OBJDIR) - @echo "Compiling Plot.cpp" - @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" - $(OBJDIR)/PlotUtils_9ef52686.o: ../../Source/Processors/Visualization/SpikePlotting/PlotUtils.cpp -@mkdir -p $(OBJDIR) @echo "Compiling PlotUtils.cpp" @@ -314,11 +307,6 @@ $(OBJDIR)/TetrodePlot_b42fd798.o: ../../Source/Processors/Visualization/SpikePlo @echo "Compiling TetrodePlot.cpp" @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" -$(OBJDIR)/TetrodeSource_612b6d52.o: ../../Source/Processors/Visualization/SpikePlotting/TetrodeSource.cpp - -@mkdir -p $(OBJDIR) - @echo "Compiling TetrodeSource.cpp" - @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" - $(OBJDIR)/TitleBox_c4a9cde7.o: ../../Source/Processors/Visualization/SpikePlotting/TitleBox.cpp -@mkdir -p $(OBJDIR) @echo "Compiling TitleBox.cpp" diff --git a/Builds/MacOSX/open-ephys.xcodeproj/project.pbxproj b/Builds/MacOSX/open-ephys.xcodeproj/project.pbxproj index 5a72e805410e0a28e78f1eaf47d1a4846c39bc82..cbed92cd9f990ce2254ae56c92e253c6e77ccfed 100644 --- a/Builds/MacOSX/open-ephys.xcodeproj/project.pbxproj +++ b/Builds/MacOSX/open-ephys.xcodeproj/project.pbxproj @@ -46,11 +46,9 @@ 938FC2F779C2CF4B8C7ECFFE = { isa = PBXBuildFile; fileRef = 3BB44F767E701E3642435FA0; }; 55A240CCFCD604CA8DF8FC8C = { isa = PBXBuildFile; fileRef = 41591F74A761BAC908FA8AD8; }; 8025F04ED261C7F7D2DC0F06 = { isa = PBXBuildFile; fileRef = 24C6D768C87E1C42C644C4BD; }; - 5BF39041C97178762F2A80E2 = { isa = PBXBuildFile; fileRef = 973E19C898C17FCD25544AB3; }; 49F046C8BE137BF77338DD7B = { isa = PBXBuildFile; fileRef = B195AD6CEB9B6E3625C8D087; }; 566E42D2B7105CFB4DB45170 = { isa = PBXBuildFile; fileRef = 2FA2FA826CBAD9C639A61E4A; }; 0DDC562EC2B04A26AE6CBB2B = { isa = PBXBuildFile; fileRef = FBB9A423728922E96F55074F; }; - 604CD950A69E64B77BC42B6A = { isa = PBXBuildFile; fileRef = 1055491125D9265362750727; }; 39E2F4E31D24BED6E85C489D = { isa = PBXBuildFile; fileRef = 7A9571EBFAAD39E47DE12A10; }; BCD7C4797178C8EF65CDC2D7 = { isa = PBXBuildFile; fileRef = 9F208A66C09E80D14F087CB1; }; 9145D84C7D665BCAFE698432 = { isa = PBXBuildFile; fileRef = E7247F5EE9588903C924994F; }; @@ -213,8 +211,6 @@ 9C8EA29582DBFF6E5A14B8A3 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = BaseUIElement.h; path = ../../Source/Processors/Visualization/SpikePlotting/BaseUIElement.h; sourceTree = "SOURCE_ROOT"; }; 24C6D768C87E1C42C644C4BD = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = GenericAxes.cpp; path = ../../Source/Processors/Visualization/SpikePlotting/GenericAxes.cpp; sourceTree = "SOURCE_ROOT"; }; BCBB865ED53E8AFD278D1A53 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = GenericAxes.h; path = ../../Source/Processors/Visualization/SpikePlotting/GenericAxes.h; sourceTree = "SOURCE_ROOT"; }; - 973E19C898C17FCD25544AB3 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Plot.cpp; path = ../../Source/Processors/Visualization/SpikePlotting/Plot.cpp; sourceTree = "SOURCE_ROOT"; }; - 6C02273DBE89D4A89EBC8581 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Plot.h; path = ../../Source/Processors/Visualization/SpikePlotting/Plot.h; sourceTree = "SOURCE_ROOT"; }; B195AD6CEB9B6E3625C8D087 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = PlotUtils.cpp; path = ../../Source/Processors/Visualization/SpikePlotting/PlotUtils.cpp; sourceTree = "SOURCE_ROOT"; }; 521FECC75E9DDB0D34B22AF8 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PlotUtils.h; path = ../../Source/Processors/Visualization/SpikePlotting/PlotUtils.h; sourceTree = "SOURCE_ROOT"; }; 2FA2FA826CBAD9C639A61E4A = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ProjectionAxes.cpp; path = ../../Source/Processors/Visualization/SpikePlotting/ProjectionAxes.cpp; sourceTree = "SOURCE_ROOT"; }; @@ -222,8 +218,6 @@ 50E7B88E8140BB293B27ED67 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SimpleKeyEvent.h; path = ../../Source/Processors/Visualization/SpikePlotting/SimpleKeyEvent.h; sourceTree = "SOURCE_ROOT"; }; FBB9A423728922E96F55074F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = TetrodePlot.cpp; path = ../../Source/Processors/Visualization/SpikePlotting/TetrodePlot.cpp; sourceTree = "SOURCE_ROOT"; }; 6CFF95D08DB1000B1EDD1240 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TetrodePlot.h; path = ../../Source/Processors/Visualization/SpikePlotting/TetrodePlot.h; sourceTree = "SOURCE_ROOT"; }; - 1055491125D9265362750727 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = TetrodeSource.cpp; path = ../../Source/Processors/Visualization/SpikePlotting/TetrodeSource.cpp; sourceTree = "SOURCE_ROOT"; }; - 1C3E37A913F761086142B9F0 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TetrodeSource.h; path = ../../Source/Processors/Visualization/SpikePlotting/TetrodeSource.h; sourceTree = "SOURCE_ROOT"; }; 7A9571EBFAAD39E47DE12A10 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = TitleBox.cpp; path = ../../Source/Processors/Visualization/SpikePlotting/TitleBox.cpp; sourceTree = "SOURCE_ROOT"; }; 180386FCFC4315DCB499E837 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TitleBox.h; path = ../../Source/Processors/Visualization/SpikePlotting/TitleBox.h; sourceTree = "SOURCE_ROOT"; }; 9F208A66C09E80D14F087CB1 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = WaveAxes.cpp; path = ../../Source/Processors/Visualization/SpikePlotting/WaveAxes.cpp; sourceTree = "SOURCE_ROOT"; }; @@ -434,8 +428,6 @@ 9C8EA29582DBFF6E5A14B8A3, 24C6D768C87E1C42C644C4BD, BCBB865ED53E8AFD278D1A53, - 973E19C898C17FCD25544AB3, - 6C02273DBE89D4A89EBC8581, B195AD6CEB9B6E3625C8D087, 521FECC75E9DDB0D34B22AF8, 2FA2FA826CBAD9C639A61E4A, @@ -443,8 +435,6 @@ 50E7B88E8140BB293B27ED67, FBB9A423728922E96F55074F, 6CFF95D08DB1000B1EDD1240, - 1055491125D9265362750727, - 1C3E37A913F761086142B9F0, 7A9571EBFAAD39E47DE12A10, 180386FCFC4315DCB499E837, 9F208A66C09E80D14F087CB1, @@ -703,11 +693,9 @@ 938FC2F779C2CF4B8C7ECFFE, 55A240CCFCD604CA8DF8FC8C, 8025F04ED261C7F7D2DC0F06, - 5BF39041C97178762F2A80E2, 49F046C8BE137BF77338DD7B, 566E42D2B7105CFB4DB45170, 0DDC562EC2B04A26AE6CBB2B, - 604CD950A69E64B77BC42B6A, 39E2F4E31D24BED6E85C489D, BCD7C4797178C8EF65CDC2D7, 9145D84C7D665BCAFE698432, diff --git a/Source/Processors/ProcessorGraph.cpp b/Source/Processors/ProcessorGraph.cpp index 25d8cdd5626140bab5f4d4d5ac86b887eb83dc42..52aceec6534e79e17c38515cdc2c2e6d23738d51 100644 --- a/Source/Processors/ProcessorGraph.cpp +++ b/Source/Processors/ProcessorGraph.cpp @@ -385,8 +385,7 @@ GenericProcessor* ProcessorGraph::createProcessorFromDescription(String& descrip } else if (subProcessorType.equalsIgnoreCase("Spike Viewer")) { std::cout << "Creating an SpikeDisplayNode." << std::endl; - processor = new SpikeDisplayNode(); - + processor = new SpikeDisplayNode(); } else if (subProcessorType.equalsIgnoreCase("WiFi Output")) { std::cout << "Creating a WiFi node." << std::endl; diff --git a/Source/Processors/SpikeDisplayNode.h b/Source/Processors/SpikeDisplayNode.h index 950e9a84bde18fa1a291a8b3312740d33a62b6ce..0f795a82c596c8a506685fc616159c1a8c808e40 100644 --- a/Source/Processors/SpikeDisplayNode.h +++ b/Source/Processors/SpikeDisplayNode.h @@ -29,7 +29,6 @@ #include "Editors/VisualizerEditor.h" #include "GenericProcessor.h" #include "Visualization/SpikeObject.h" -#include <queue> /** @@ -72,10 +71,10 @@ private: int numberOfSources; AbstractFifo abstractFifo; - //ScopedPointer<AudioSampleBuffer> displayBuffer; + ScopedPointer<AudioSampleBuffer> displayBuffer; ScopedPointer<MidiBuffer> eventBuffer; - std::queue<SpikeObject> spikebuffer; + //std::queue<SpikeObject> spikebuffer; int bufferSize; //bool resizeBuffer(); diff --git a/Source/Processors/Visualization/OpenGLCanvas.cpp b/Source/Processors/Visualization/OpenGLCanvas.cpp index 7b5ee046c90fcce38ac89dd19a123f14558f0176..1d8b338560686110da6e9d526bc49a4ae8d81a71 100644 --- a/Source/Processors/Visualization/OpenGLCanvas.cpp +++ b/Source/Processors/Visualization/OpenGLCanvas.cpp @@ -210,6 +210,7 @@ void OpenGLCanvas::stopCallbacks() void OpenGLCanvas::drawScrollBars() { + float scrollBarY = float(getHeight())/float(getTotalHeight()); float timeSinceScroll = timer->getMillisecondCounter()-scrollTime; @@ -238,6 +239,7 @@ void OpenGLCanvas::drawScrollBars() } showScrollTrack = false; } + } void OpenGLCanvas::drawScrollBar(float y1, float y2, float alpha) diff --git a/Source/Processors/Visualization/SpikeDisplayCanvas.cpp b/Source/Processors/Visualization/SpikeDisplayCanvas.cpp index f934eaa5279c62a0ac65b4a229d41595ead9df7a..153e14547050da9047c626885c642f05afc567e1 100644 --- a/Source/Processors/Visualization/SpikeDisplayCanvas.cpp +++ b/Source/Processors/Visualization/SpikeDisplayCanvas.cpp @@ -47,7 +47,6 @@ SpikeDisplayCanvas::SpikeDisplayCanvas(SpikeDisplayNode* n) : processor(n), // displayBufferSize = displayBuffer->getNumSamples(); // std::cout << "Setting displayBufferSize on SpikeDisplayCanvas to " << displayBufferSize << std::endl; - // totalHeight = (plotHeight+yBuffer)*nChans + yBuffer; // screenBuffer = new AudioSampleBuffer(nChans, 10000); @@ -63,7 +62,7 @@ void SpikeDisplayCanvas::initializeSpikePlots(){ int xPadding = 10; int yPadding = 10; - int nPlots = 4; + int nPlots = 2; int totalWidth = 900; // This is a hack the width as the width isn't known before its drawn @@ -71,7 +70,7 @@ void SpikeDisplayCanvas::initializeSpikePlots(){ int plotHeight = plotWidth / 2; for (int i=0; i<nPlots; i++) { - StereotrodePlot p = StereotrodePlot( xPadding + i * (plotWidth + xPadding) , yPadding, plotWidth, plotHeight, ""); + TetrodePlot p = TetrodePlot( xPadding + i * (plotWidth + xPadding) , yPadding, plotWidth, plotHeight, ""); plots.push_back(p); } } @@ -157,20 +156,19 @@ void SpikeDisplayCanvas::canvasWasResized() void SpikeDisplayCanvas::renderOpenGL() { glClear(GL_COLOR_BUFFER_BIT); // clear buffers to preset values - std::cout<<"SpikeDisplayCanvas::renderOpenGL"<<std::endl; - - +// std::cout<<"SpikeDisplayCanvas::renderOpenGL"<<std::endl; // Get Spikes from the processor // Iterate through each spike, passing them individually to the appropriate plots and calling redraw before moving on to the next spike //while(processor->getNextSpike(&spike)) //{ - // Identify which plot the spike should go to - - // Distribute those spike to the appropriate plot object + // Identify which plot the spike should go to + + // Distribute those spike to the appropriate plot object SpikeObject tmpSpike; + for (int i=0; i<plots.size(); i++){ generateSimulatedSpike(&tmpSpike, 0, 100); plots[i].processSpikeObject(tmpSpike); diff --git a/Source/Processors/Visualization/SpikeDisplayCanvas.h b/Source/Processors/Visualization/SpikeDisplayCanvas.h index 192ac8ee64540b2156373d57513619b02fffcd78..a10bb1e01a0116a74211aeeb2e8990a5515cfdec 100644 --- a/Source/Processors/Visualization/SpikeDisplayCanvas.h +++ b/Source/Processors/Visualization/SpikeDisplayCanvas.h @@ -28,6 +28,7 @@ #include "../SpikeDisplayNode.h" #include "SpikePlotting/ElectrodePlot.h" #include "SpikePlotting/StereotrodePlot.h" +#include "SpikePlotting/TetrodePlot.h" #include "SpikeObject.h" #include "Visualizer.h" @@ -64,7 +65,7 @@ private: bool newSpike; SpikeObject spike; SpikeDisplayNode* processor; - std::vector<StereotrodePlot> plots; + std::vector<TetrodePlot> plots; // AudioSampleBuffer* displayBuffer; // ScopedPointer<AudioSampleBuffer> screenBuffer; // MidiBuffer* eventBuffer; diff --git a/Source/Processors/Visualization/SpikePlotting/ProjectionAxes.cpp b/Source/Processors/Visualization/SpikePlotting/ProjectionAxes.cpp index f0fa5378325de41de2c2fc6ed9468beea2df47a1..f94585942565cfeef4943d4126ccbfa5fc18a488 100644 --- a/Source/Processors/Visualization/SpikePlotting/ProjectionAxes.cpp +++ b/Source/Processors/Visualization/SpikePlotting/ProjectionAxes.cpp @@ -60,12 +60,16 @@ void ProjectionAxes::plot(){ //if (drawGrid) // drawProjectionGrid(s.gain[d1], s.gain[d2]); - glColor3fv(pointColor); - glPointSize(1); + glColor3f(1.0, 1.0, 1.0); + glPointSize(10); glBegin(GL_POINTS); glVertex2f(s.data[idx1], s.data[idx2]); glEnd(); + + // std::cout<<"ProjectionAxes Limits:"<<ylims[0]<<" "<<ylims[1]<<std::endl; + // std::cout<<"ProjectionAxes::plot()"<<s.data[idx1] << " " << s.data[idx2]<<std::endl; + } void ProjectionAxes::calcWaveformPeakIdx(int d1, int d2, int *idx1, int *idx2){ diff --git a/Source/Processors/Visualization/SpikePlotting/StereotrodePlot.cpp b/Source/Processors/Visualization/SpikePlotting/StereotrodePlot.cpp index 25ee2445a9833b120cc4a1abed2ad9fdead6ea0e..5579fad26bb53e5bb38c19927b73c53525af51ca 100644 --- a/Source/Processors/Visualization/SpikePlotting/StereotrodePlot.cpp +++ b/Source/Processors/Visualization/SpikePlotting/StereotrodePlot.cpp @@ -29,8 +29,8 @@ StereotrodePlot::~StereotrodePlot(){ void StereotrodePlot::redraw(){ //std::cout<<"StereotrodePlot() starting drawing"<<std::endl;\ - BaseUIElement::clearNextDraw = true; - BaseUIElement::redraw(); + //BaseUIElement::clearNextDraw = true; + //BaseUIElement::redraw(); wAxes[0].redraw(); wAxes[1].redraw(); diff --git a/Source/Processors/Visualization/SpikePlotting/TetrodePlot.cpp b/Source/Processors/Visualization/SpikePlotting/TetrodePlot.cpp index 2357bcbd1b0d3495e003b2b919c2333dbbe5d746..d7c4db48a3b07c55c23b5b55e755da91f1718777 100644 --- a/Source/Processors/Visualization/SpikePlotting/TetrodePlot.cpp +++ b/Source/Processors/Visualization/SpikePlotting/TetrodePlot.cpp @@ -1,27 +1,25 @@ #include "TetrodePlot.h" +#include "../SpikeObject.h" +#include "PlotUtils.h" TetrodePlot::TetrodePlot(): -BaseUIElement(), -titleHeight(15), -enableTitle(true), -limitsChanged(true){ - plotTitle = (char*) "TetrodePlot"; - //titleBox = ArteTitleBox(100-titleHeight,0,2,titleHeight, plotTitle); -// BaseUIElement::elementName = (char*) "ArtePlot"; - + BaseUIElement(), titleHeight(0), enableTitle(true), limitsChanged(true) +{ + plotTitle = (char*) "Tetrode Plot"; + } + TetrodePlot::TetrodePlot(int x, int y, int w, int h, char *n): -BaseUIElement(x,y,w,h,1), -titleHeight(15), -enableTitle(true), -limitsChanged(true){ - plotTitle = n; - - titleBox = TitleBox(x, y+h-titleHeight-3, w, titleHeight+3, plotTitle); -// std::cout<< x+h-titleHeight << "," << y << " - " << w << "," <<titleHeight<<std::endl; -// BaseUIElement::elementName = (char*) "ArtePlot"; + BaseUIElement(x,y,w,h,1), titleHeight(0), enableTitle(true), limitsChanged(true) +{ + plotTitle = n; + titleBox = TitleBox(x, y+h-titleHeight-3, w, titleHeight+3, plotTitle); + + initAxes(); } +TetrodePlot::~TetrodePlot(){ +} // Each plot needs to update its children axes when its redraw gets called. // it also needs to call the parent plot when children axes get added it @@ -30,165 +28,111 @@ limitsChanged(true){ // the right direction void TetrodePlot::redraw(){ - // std::cout<<"TetrodePlot() starting drawing"<<std::endl; - BaseUIElement::redraw(); - - // SpikeObject tempSpike; - // std::list<GenericAxes>::iterator i; - // bool axesDrawnOnce = false; - // while(tetSource.getNextSpike(&tempSpike)){ - // axesDrawnOnce = true; - // for (i=axesList.begin(); i!= axesList.end(); ++i){ - // i->updateSpikeData(tempSpike); - - // if (limitsChanged){ - - // int n = i->getType(); - - // if (n>=WAVE1 && n<=WAVE4) - // i->setYLims(limits[n][0], limits[n][1]); - - // else if( n>=PROJ1x2 && n<=PROJ3x4){ - // int d1, d2; - // n2ProjIdx(i->getType(), &d1, &d2); - // i->setXLims(limits[d1][0], limits[d1][1]); - // i->setYLims(limits[d2][0], limits[d2][1]); - // } - // } - // i->redraw(); - - // } - // if (limitsChanged) - // limitsChanged = false; - // } - - // if (!axesDrawnOnce) - // for (i= axesList.begin(); i!=axesList.end(); ++i) - // i->redraw(); - - // titleBox.redraw(); - // BaseUIElement::drawElementEdges(); - // // std::cout<<"TetrodePlot() Done drawing"<<std::endl; + //std::cout<<"TetrodePlot() starting drawing"<<std::endl;\ + BaseUIElement::clearNextDraw = true; + + BaseUIElement::redraw(); + + for (int i=0; i<4; i++) + wAxes[i].redraw(); + + for (int i=0; i<6; i++) + pAxes[i].redraw(); } +// This would normally happen for collection of axes but an electrode plot doesn't have a collection instead its a single axes +void TetrodePlot::processSpikeObject(SpikeObject s){ + //std::cout<<"ElectrdePlot::processSpikeObject()"<<std::endl; + for (int i=0; i<4; i++) + wAxes[i].updateSpikeData(s); + for (int i=0; i<6; i++) + pAxes[i].updateSpikeData(s); +} void TetrodePlot::setTitle(char *n){ - plotTitle = n; + plotTitle = n; } void TetrodePlot::setEnabled(bool e){ - BaseUIElement::enabled = e; - std::list<GenericAxes>::iterator i; - for (i = axesList.begin(); i!= axesList.end(); ++i){ - i->setEnabled(e); - } + BaseUIElement::enabled = e; + for (int i=0; i<4; i++) + wAxes[i].setEnabled(e); + for (int i=0; i<6; i++) + pAxes[i].setEnabled(e); } bool TetrodePlot::getEnabled(){ - return BaseUIElement::enabled; + return BaseUIElement::enabled; } void TetrodePlot::initAxes(){ - initLimits(); + initLimits(); int minX = BaseUIElement::xpos; - int minY = BaseUIElement::ypos; - - double axesWidth = BaseUIElement::width/4.0; - double axesHeight = (BaseUIElement::height - titleHeight)/2.0; - - int axX, axY; - - if (!axesList.empty()){ - std::list<GenericAxes> tmp; - axesList = tmp; - } - - for (int i=WAVE1; i<=WAVE4; i++) // macro constants from GenericAxes.h - { - // divide axes width by 2 because wave plots are half of a projection plot width - axX = minX + axesWidth/2 * ( i % 2); - axY = minY + axesHeight * ( i / 2); - WaveAxes ax = WaveAxes(axX, axY, axesWidth/2, axesHeight, i); - ax.setEnabled(false); - ax.setYLims(-1*pow(2,11), pow(2,14)); - axesList.push_back(ax); - switch(i){ - case 0: - ax.setWaveformColor(1.0, 0.0, 0.0); - break; - case 1: - ax.setWaveformColor(0.0, 1.0, 0.0); - break; - case 2: - ax.setWaveformColor(0.0, 0.0, 1.0); - break; - case 3: - ax.setWaveformColor(1.0, 1.0, 0.0); - break; - } - } - - for (int i=PROJ1x2; i<=PROJ3x4; i++){ - // use i2 instead of i so we can index from 0 instead of 4 for the plot placement - int i2 = i - PROJ1x2; - axX = minX + axesWidth * (i2%3 + 1); // add 1 to offset for the waveform plots - axY = minY + axesHeight * (i2 / 3); // no need to offset for the y direction - - GenericAxes ax = GenericAxes(axX, axY, axesWidth, axesHeight, i); - ax.setEnabled(true); - int d1, d2; - n2ProjIdx(i, &d1, &d2); - ax.setXLims(limits[d1][0], limits[d1][1]); - ax.setYLims(limits[d1][0], limits[d1][1]); -// ax.setXLims(-1*pow(2,11), pow(2,14)); -// ax.setYLims(-1*pow(2,11), pow(2,14)); - - axesList.push_back(ax); - } + int minY = BaseUIElement::ypos; + + // because axesWidth and axesHeight won't always divide evenly we'll add .5 to the ending value to round + // to the nearest integer, this forces the box to draw to the next biggest pixel if needed. this prevents + // black borders from forming around the boxes + int axesWidth = BaseUIElement::width/4 + .5; + int axesHeight = (BaseUIElement::height - titleHeight)/2 + .5; + + + wAxes[0] = WaveAxes(minX, minY, axesWidth/2, axesHeight, WAVE1); + wAxes[1] = WaveAxes(minX + axesWidth/2, minY, axesWidth/2, axesHeight, WAVE2); + wAxes[2] = WaveAxes(minX, minY + axesHeight, axesWidth/2, axesHeight, WAVE3); + wAxes[3] = WaveAxes(minX + axesWidth/2, minY + axesHeight, axesWidth/2, axesHeight, WAVE3); + + pAxes[0] = ProjectionAxes(minX + axesWidth*1, minY, axesWidth, axesHeight, PROJ1x2); + pAxes[1] = ProjectionAxes(minX + axesWidth*2, minY, axesWidth, axesHeight, PROJ1x3); + pAxes[2] = ProjectionAxes(minX + axesWidth*3, minY, axesWidth, axesHeight, PROJ1x4); + pAxes[3] = ProjectionAxes(minX + axesWidth*1, minY + axesHeight, axesWidth, axesHeight, PROJ2x3); + pAxes[4] = ProjectionAxes(minX + axesWidth*2, minY + axesHeight, axesWidth, axesHeight, PROJ2x4); + pAxes[5] = ProjectionAxes(minX + axesWidth*3, minY + axesHeight, axesWidth, axesHeight, PROJ3x4); + + + //axes.setEnabled(false); + for (int i=0; i<4; i++){ + wAxes[i].setYLims(-1*pow(2,11), pow(2,14)*1.6); + wAxes[i].setWaveformColor(1.0, 1.0, 1.0); + } + for (int i=0; i<6; i++) + { + pAxes[i].setYLims(-1*pow(2,11), pow(2,14)*1.6); + pAxes[i].setPointColor(1.0, 1.0, 1.0); + } + } void TetrodePlot::setPosition(int x, int y, double w, double h){ - BaseUIElement::setPosition(x,y,w,h); - int minX = BaseUIElement::xpos; - int minY = BaseUIElement::ypos; - - double axesWidth = BaseUIElement::width/4.0; - double axesHeight = (BaseUIElement::height - titleHeight)/2.0; - - int axX, axY; - - std::list<GenericAxes>::iterator i; - int idx = 0, idx2 = 0; - - for (i=axesList.begin(); i!=axesList.end(); ++i){ - if (idx<=WAVE4){ - axX = minX + axesWidth/2 * ( idx % 2 ); - axY = minY + axesHeight * ( idx / 2); - i->setPosition(axX, axY, axesWidth/2, axesHeight); - } - else{ - idx2 = idx - PROJ1x2; - axX = minX + axesWidth * (idx2 % 3 + 1); // add 1 to offset for the waveform plots - axY = minY + axesHeight * (idx2 / 3); // no need to offset for the y direction - i->setPosition(axX, axY, axesWidth, axesHeight); - } - idx++; - } - - titleBox.setPosition(x, y+h-titleHeight-3, w, titleHeight+3); + BaseUIElement::setPosition(x,y,w,h); + int minX = BaseUIElement::xpos; + int minY = BaseUIElement::ypos; + + int axesWidth = BaseUIElement::width/4; + int axesHeight = BaseUIElement::height - titleHeight/2; + + wAxes[0].setPosition(minX, minY, axesWidth/2, axesHeight); + wAxes[1].setPosition(minX + axesWidth/2, minY, axesWidth/2, axesHeight); + wAxes[2].setPosition(minX, minY + axesHeight, axesWidth/2, axesHeight); + wAxes[3].setPosition(minX + axesWidth/2, minY + axesHeight, axesWidth/2, axesHeight); + + pAxes[0].setPosition(minX + axesWidth*1, minY, axesWidth, axesHeight); + pAxes[1].setPosition(minX + axesWidth*2, minY, axesWidth, axesHeight); + pAxes[2].setPosition(minX + axesWidth*3, minY, axesWidth, axesHeight); + pAxes[3].setPosition(minX + axesWidth*1, minY + axesHeight, axesWidth, axesHeight); + pAxes[4].setPosition(minX + axesWidth*2, minY + axesHeight, axesWidth, axesHeight); + pAxes[5].setPosition(minX + axesWidth*3, minY + axesHeight, axesWidth, axesHeight); + + //titleBox.setPosition(x, y+h-titleHeight-3, w, titleHeight+3); } int TetrodePlot::getNumberOfAxes(){ - return axesList.size(); + return 1;; } -// TetrodeSource* TetrodePlot::getDataSource(){ -// return &tetSource; -// } - void TetrodePlot::clearOnNextDraw(bool b){ - BaseUIElement::clearNextDraw = b; + BaseUIElement::clearNextDraw = b; } void TetrodePlot::setTitleEnabled(bool e){ @@ -205,233 +149,175 @@ void TetrodePlot::setTitleEnabled(bool e){ setPosition(BaseUIElement::xpos, BaseUIElement::ypos, BaseUIElement::width, BaseUIElement::height); } - - -void TetrodePlot::mouseDown(int x, int y){ - - selectedAxesN = -1; - std::list<GenericAxes>::iterator i; - int idx=-1; - bool hit = false; - - selectedAxes = NULL; - for (i=axesList.begin(); i!=axesList.end(); ++i) +void TetrodePlot::initLimits(){ + for (int i=0; i<4; i++) { - if (i->hitTest(x,y)) - { - selectedAxes = addressof(*i); - selectedAxesN = i->getType(); - hit = true; -// break; - } - idx++; + limits[i][0] = -1*pow(2,11); + limits[i][1] = pow(2,14); } - if (!hit) - selectedAxes = NULL; - if (selectedAxes != NULL) - std::cout<<"TetrodePlot::mouseDown() hit:"<<selectedAxes<<" AxesType:"<<selectedAxes->getType()<<std::endl; - else - std::cout<<"TetrodePlot::mouseDown() NO HIT!"<<std::endl; - -} -void TetrodePlot::mouseDragX(int dx, bool shift, bool ctrl){ - - if (selectedAxes == NULL || dx==0) - return; -// zoomAxes(selectedAxes->getType(), true, dx>0); - if (shift) - zoomAxes(selectedAxesN, true, dx); - if (ctrl) - panAxes(selectedAxesN, true, dx); } -void TetrodePlot::mouseDragY(int dy, bool shift, bool ctrl){ - if (selectedAxes == NULL || dy==0) - return; - if(shift) - zoomAxes(selectedAxesN, false, dy); - if(ctrl) - panAxes(selectedAxesN, false, dy); -} -void TetrodePlot::zoomAxes(int n, bool xdim, int zoom){ -// std::cout<<"TetrodePlot::zoomAxes() n:"<< n<<" xdim"<< xdim<<" in:"<<zoomin<<std::endl; - // If trying to zoom an invalid axes type - if (n<WAVE1 || n>PROJ3x4) - return; - if (n<=WAVE4) - zoomWaveform(n, xdim, zoom); - else - zoomProjection(n, xdim, zoom); +void TetrodePlot::getPreferredDimensions(double *w, double *h){ + *w = 75; + *h = 75; } +// void TetrodePlot::mouseDown(int x, int y){ + +// // selectedAxesN = -1; +// // std::list<GenericAxes>::iterator i; +// // int idx=-1; +// // bool hit = false; + +// // selectedAxes = NULL; +// // for (i=axesList.begin(); i!=axesList.end(); ++i) +// // { +// // if (i->hitTest(x,y)) +// // { +// // selectedAxes = addressof(*i); +// // selectedAxesN = i->getType(); +// // hit = true; +// // // break; +// // } +// // idx++; +// // } +// // if (!hit) +// // selectedAxes = NULL; +// // if (selectedAxes != NULL) +// // std::cout<<"TetrodePlot::mouseDown() hit:"<<selectedAxes<<" AxesType:"<<selectedaxes.getType()<<std::endl; +// // else +// // std::cout<<"TetrodePlot::mouseDown() NO HIT!"<<std::endl; + +// } +// void TetrodePlot::mouseDragX(int dx, bool shift, bool ctrl){ -void TetrodePlot::zoomWaveform(int n, bool xdim, int zoom){ +// // if (selectedAxes == NULL || dx==0) +// // return; +// // // zoomAxes(selectedaxes.getType(), true, dx>0); +// // if (shift) +// // zoomAxes(selectedAxesN, true, dx); +// // if (ctrl) +// // panAxes(selectedAxesN, true, dx); - // waveform plots don't have a xlimits - if (xdim) - return; -// std::cout<<"Zooming Waveform:"<<n<<" zoomin:"<<zoomin<<" "; - double min, max; - - if(xdim) - return; +// } +// void TetrodePlot::mouseDragY(int dy, bool shift, bool ctrl){ +// if (selectedAxes == NULL || dy==0) +// return; +// if(shift) +// zoomAxes(selectedAxesN, false, dy); +// if(ctrl) +// panAxes(selectedAxesN, false, dy); +// } - min = limits[n][0]; - max = limits[n][1]; - - double mean = (max + min)/2.0f; - double delta = max - mean; - delta = delta / pow(.99, -1*zoom); +// void TetrodePlot::zoomAxes(int n, bool xdim, int zoom){ +// // std::cout<<"TetrodePlot::zoomAxes() n:"<< n<<" xdim"<< xdim<<" in:"<<zoomin<<std::endl; +// // If trying to zoom an invalid axes type +// if (n<WAVE1 || n>PROJ3x4) +// return; +// if (n<=WAVE4) +// zoomWaveform(n, xdim, zoom); +// else +// zoomProjection(n, xdim, zoom); +// } - min = mean - delta; - max = mean + delta; +// void TetrodePlot::zoomWaveform(int n, bool xdim, int zoom){ - limits[n][0] = min; - limits[n][1] = max; - - limitsChanged = true; -} -void TetrodePlot::zoomProjection(int n, bool xdim, int zoom){ - int d1, d2; - n2ProjIdx(n, &d1, &d2); +// // waveform plots don't have a xlimits +// if (xdim) +// return; +// // std::cout<<"Zooming Waveform:"<<n<<" zoomin:"<<zoomin<<" "; +// double min, max; - if(xdim) - n = d1; - else - n = d2; +// if(xdim) +// return; - double min, max; - - min = limits[n][0]; - max = limits[n][1]; - - double mean = (max + min)/2.0f; - double delta = max - mean; - delta = delta / pow(.99, -1*zoom); - - min = mean - delta; - max = mean + delta; - +// min = limits[n][0]; +// max = limits[n][1]; - - limits[n][0] = min; - limits[n][1] = max; - - limitsChanged = true; +// double mean = (max + min)/2.0f; +// double delta = max - mean; +// delta = delta / pow(.99, -1*zoom); -} -void TetrodePlot::panAxes(int n, bool xdim, int panval){ - // std::cout<<"TetrodePlot::zoomAxes() n:"<< n<<" xdim"<< xdim<<" in:"<<zoomin<<std::endl; - // If trying to zoom an invalid axes type - if (n<WAVE1 || n>PROJ3x4) - return; - if (n<=WAVE4) - panWaveform(n, xdim, panval); - else - panProjection(n, xdim, panval); -} +// min = mean - delta; +// max = mean + delta; -void TetrodePlot::panWaveform(int n, bool xdim, int pan){ - - // waveform plots don't have a xlimits - if (xdim) - return; - // std::cout<<"Panning Waveform:"<<n<<" pan:"<<pan<<" "<<std::endl; - double min, max; - - if(xdim) - return; - - min = limits[n][0]; - max = limits[n][1]; - - double dy = max-min; - - // Need to grab something if pan event is driven by the keyboard, which means that all the plots are getting panned so this should be okay - if (selectedAxes == NULL) - selectedAxes = &axesList.front(); - - double yPixels = (BaseUIElement::height - titleHeight)/2.0; +// limits[n][0] = min; +// limits[n][1] = max; - double pixelWidth = -1 * dy/yPixels; - - double delta = pan * pixelWidth; - min = min + delta; - max = max + delta; - - limits[n][0] = min; - limits[n][1] = max; - - limitsChanged = true; -} -void TetrodePlot::panProjection(int n, bool xdim, int pan){ - int d1, d2; - n2ProjIdx(n, &d1, &d2); - - if(xdim) - n = d1; - else - n = d2; - - double min, max; +// limitsChanged = true; +// } + +// void TetrodePlot::panAxes(int n, bool xdim, int panval){ +// // std::cout<<"TetrodePlot::zoomAxes() n:"<< n<<" xdim"<< xdim<<" in:"<<zoomin<<std::endl; +// // If trying to zoom an invalid axes type +// if (n<WAVE1 || n>PROJ3x4) +// return; +// if (n<=WAVE4) +// panWaveform(n, xdim, panval); +// else +// panProjection(n, xdim, panval); +// } + +// void TetrodePlot::panWaveform(int n, bool xdim, int pan){ - min = limits[n][0]; - max = limits[n][1]; +// // waveform plots don't have a xlimits +// if (xdim) +// return; +// // std::cout<<"Panning Waveform:"<<n<<" pan:"<<pan<<" "<<std::endl; +// double min, max; - double dy = max-min; +// if(xdim) +// return; - double yPixels = (BaseUIElement::height - titleHeight)/2.0; +// min = limits[n][0]; +// max = limits[n][1]; - double pixelWidth = -1 * dy/yPixels; +// double dy = max-min; - double delta = pan * pixelWidth; - min = min + delta; - max = max + delta; +// // Need to grab something if pan event is driven by the keyboard, which means that all the plots are getting panned so this should be okay +// if (selectedAxes == NULL) +// selectedAxes = &axesList.front(); - limits[n][0] = min; - limits[n][1] = max; +// double yPixels = (BaseUIElement::height - titleHeight)/2.0; +// double pixelWidth = -1 * dy/yPixels; - limits[n][0] = min; - limits[n][1] = max; +// double delta = pan * pixelWidth; +// min = min + delta; +// max = max + delta; - limitsChanged = true; +// limits[n][0] = min; +// limits[n][1] = max; -} +// limitsChanged = true; +// } -void TetrodePlot::initLimits(){ - for (int i=0; i<4; i++) - { - limits[i][0] = -1*pow(2,11); - limits[i][1] = pow(2,14); - } -} bool TetrodePlot::processKeyEvent(SimpleKeyEvent k){ - std::cout<<"Key:"<<(char)k.key<<std::endl; - switch(k.key) - { - case '=': - for (int i=0; i<=WAVE4; i++) - zoomWaveform(i, false, 3); - break; - case '+': - for (int i=0; i<=WAVE4; i++) - panWaveform(i, false, 3); - break; - case '-': - for (int i=0; i<=WAVE4; i++) - zoomWaveform(i, false, -3); - break; - case '_': - for (int i=0; i<=WAVE4; i++) - panWaveform(i, false, -3); - break; - case 'C': - clearOnNextDraw(true); - break; - } + // std::cout<<"Key:"<<(char)k.key<<std::endl; + // switch(k.key) + // { + // case '=': + // for (int i=0; i<=WAVE4; i++) + // zoomWaveform(i, false, 3); + // break; + // case '+': + // for (int i=0; i<=WAVE4; i++) + // panWaveform(i, false, 3); + // break; + // case '-': + // for (int i=0; i<=WAVE4; i++) + // zoomWaveform(i, false, -3); + // break; + // case '_': + // for (int i=0; i<=WAVE4; i++) + // panWaveform(i, false, -3); + // break; + // case 'C': + // clearOnNextDraw(true); + // break; + // } } diff --git a/Source/Processors/Visualization/SpikePlotting/TetrodePlot.h b/Source/Processors/Visualization/SpikePlotting/TetrodePlot.h index 6c1b3ee9d168b7493b4b3e3634f4e10c651232d5..6f44a8ef94df7b07f079f41e9c4a6f33a0cc71a8 100644 --- a/Source/Processors/Visualization/SpikePlotting/TetrodePlot.h +++ b/Source/Processors/Visualization/SpikePlotting/TetrodePlot.h @@ -1,5 +1,5 @@ -#ifndef TETRODE_PLOT_H -#define TETRODE_PLOT_H +#ifndef TETRODE_PLOT_H_ +#define TETRODE_PLOT_H_ #if defined(__linux__) #include <GL/glut.h> @@ -9,7 +9,6 @@ #include <list> #include <math.h> -#include "GenericAxes.h" #include "WaveAxes.h" #include "ProjectionAxes.h" #include "TitleBox.h" @@ -22,7 +21,7 @@ class TetrodePlot : public BaseUIElement{ char *plotTitle; - std::list<GenericAxes> axesList; + TitleBox titleBox; bool enabled; @@ -30,27 +29,29 @@ class TetrodePlot : public BaseUIElement{ void drawTitle(); double titleHeight; - void *ptr; bool limitsChanged; - double limits[4][2]; + double limits[1][2]; + + WaveAxes wAxes[4]; + ProjectionAxes pAxes[6]; + - GenericAxes* selectedAxes; - int selectedAxesN; - void zoomAxes(int n, bool xdim, int zoomval); - void zoomProjection (int n, bool xdim, int zoomval); - void zoomWaveform (int n, bool xdim, int zoomval); + // void zoomAxes(int n, bool xdim, int zoomval); + // void zoomProjection (int n, bool xdim, int zoomval); + // void zoomWaveform (int n, bool xdim, int zoomval); - void panAxes(int n, bool xdim, int panval); - void panProjection (int n, bool xdim, int panval); - void panWaveform(int n, bool xdim, int panval); + // void panAxes(int n, bool xdim, int panval); + // void panProjection (int n, bool xdim, int panval); + // void panWaveform(int n, bool xdim, int panval); void initLimits(); public: TetrodePlot(); TetrodePlot(int x, int y,int w,int h, char *n); + ~TetrodePlot(); void initAxes(); void redraw(); @@ -59,6 +60,8 @@ public: bool getEnabled(); void setPosition(int,int,double,double); + void getPreferredDimensions(double*, double*); + int getNumberOfAxes(); void clearOnNextDraw(bool c); void setTitleEnabled(bool e); @@ -69,6 +72,8 @@ public: void mouseDragY(int dy, bool shift, bool ctr); bool processKeyEvent(SimpleKeyEvent k); + + void processSpikeObject(SpikeObject s); }; diff --git a/open-ephys.jucer b/open-ephys.jucer index 5b60f8d2a5e1886d020b18442d04a0cb300bfa94..d3d03772943fc34428304c6316621f7c81b2a826 100644 --- a/open-ephys.jucer +++ b/open-ephys.jucer @@ -168,8 +168,6 @@ <FILE id="PZdkKU" name="BaseUIElement.h" compile="0" resource="0" file="Source/Processors/Visualization/SpikePlotting/BaseUIElement.h"/> <FILE id="lFRVqc" name="GenericAxes.cpp" compile="1" resource="0" file="Source/Processors/Visualization/SpikePlotting/GenericAxes.cpp"/> <FILE id="BP8BOa" name="GenericAxes.h" compile="0" resource="0" file="Source/Processors/Visualization/SpikePlotting/GenericAxes.h"/> - <FILE id="I6MFjl" name="Plot.cpp" compile="1" resource="0" file="Source/Processors/Visualization/SpikePlotting/Plot.cpp"/> - <FILE id="LaaNRr" name="Plot.h" compile="0" resource="0" file="Source/Processors/Visualization/SpikePlotting/Plot.h"/> <FILE id="f7vOFh" name="PlotUtils.cpp" compile="1" resource="0" file="Source/Processors/Visualization/SpikePlotting/PlotUtils.cpp"/> <FILE id="TQfHuh" name="PlotUtils.h" compile="0" resource="0" file="Source/Processors/Visualization/SpikePlotting/PlotUtils.h"/> <FILE id="d3ducO" name="ProjectionAxes.cpp" compile="1" resource="0" @@ -180,9 +178,6 @@ file="Source/Processors/Visualization/SpikePlotting/SimpleKeyEvent.h"/> <FILE id="dP2Ikw" name="TetrodePlot.cpp" compile="1" resource="0" file="Source/Processors/Visualization/SpikePlotting/TetrodePlot.cpp"/> <FILE id="SH9Un2" name="TetrodePlot.h" compile="0" resource="0" file="Source/Processors/Visualization/SpikePlotting/TetrodePlot.h"/> - <FILE id="Cbpzk1" name="TetrodeSource.cpp" compile="1" resource="0" - file="Source/Processors/Visualization/SpikePlotting/TetrodeSource.cpp"/> - <FILE id="tqpzNj" name="TetrodeSource.h" compile="0" resource="0" file="Source/Processors/Visualization/SpikePlotting/TetrodeSource.h"/> <FILE id="g5OQRR" name="TitleBox.cpp" compile="1" resource="0" file="Source/Processors/Visualization/SpikePlotting/TitleBox.cpp"/> <FILE id="UTihqz" name="TitleBox.h" compile="0" resource="0" file="Source/Processors/Visualization/SpikePlotting/TitleBox.h"/> <FILE id="yg1Xuq" name="WaveAxes.cpp" compile="1" resource="0" file="Source/Processors/Visualization/SpikePlotting/WaveAxes.cpp"/>