Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lfpdisplaynode canvas split #344

Merged
32 changes: 31 additions & 1 deletion Plugins/LfpDisplayNode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,39 @@ add_sources(${PLUGIN_NAME}
LfpDisplayNode.h
LfpDisplayEditor.cpp
LfpDisplayEditor.h
EventDisplayInterface.cpp
EventDisplayInterface.h
LfpBitmapPlotter.h
LfpBitmapPlotterInfo.h
LfpChannelColourScheme.cpp
LfpChannelColourScheme.h
LfpChannelDisplay.cpp
LfpChannelDisplay.h
LfpChannelDisplayInfo.cpp
LfpChannelDisplayInfo.h
LfpDefaultColourScheme.cpp
LfpDefaultColourScheme.h
LfpDisplay.cpp
LfpDisplay.h
LfpDisplayCanvas.cpp
LfpDisplayCanvas.h
LfpDisplayOptions.cpp
LfpDisplayOptions.h
LfpGradientColourScheme.cpp
LfpGradientColourScheme.h
LfpMonochromaticColourScheme.cpp
LfpMonochromaticColourScheme.h
LfpTimescale.cpp
LfpTimescale.h
LfpViewport.cpp
LfpViewport.h
PerPixelBitmapPlotter.cpp
PerPixelBitmapPlotter.h
ShowHideOptionsButton.cpp
ShowHideOptionsButton.h
SupersampledBitmapPlotter.cpp
SupersampledBitmapPlotter.h
)

#optional: create IDE groups
#plugin_create_filters()
#plugin_create_filters()
108 changes: 108 additions & 0 deletions Plugins/LfpDisplayNode/EventDisplayInterface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
------------------------------------------------------------------

This file is part of the Open Ephys GUI
Copyright (C) 2013 Open Ephys

------------------------------------------------------------------

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

*/

#include "EventDisplayInterface.h"
#include "LfpDisplayNode.h"
#include "LfpDisplayCanvas.h"
#include "ShowHideOptionsButton.h"
#include "LfpDisplayOptions.h"
#include "LfpTimescale.h"
#include "LfpDisplay.h"
#include "LfpChannelDisplay.h"
#include "LfpChannelDisplayInfo.h"
#include "LfpViewport.h"
#include "LfpBitmapPlotterInfo.h"
#include "LfpBitmapPlotter.h"
#include "PerPixelBitmapPlotter.h"
#include "SupersampledBitmapPlotter.h"
#include "LfpChannelColourScheme.h"

#include <math.h>

using namespace LfpViewer;

#pragma mark - EventDisplayInterface -
// Event display Options --------------------------------------------------------------------

EventDisplayInterface::EventDisplayInterface(LfpDisplay* display_, LfpDisplayCanvas* canvas_, int chNum):
isEnabled(true), display(display_), canvas(canvas_)
{

channelNumber = chNum;

chButton = new UtilityButton(String(channelNumber+1), Font("Small Text", 13, Font::plain));
chButton->setRadius(5.0f);
chButton->setBounds(4,4,14,14);
chButton->setEnabledState(true);
chButton->setCorners(true, false, true, false);
//chButton.color = display->channelColours[channelNumber*2];
chButton->addListener(this);
addAndMakeVisible(chButton);

checkEnabledState();

}

EventDisplayInterface::~EventDisplayInterface()
{

}

void EventDisplayInterface::checkEnabledState()
{
isEnabled = display->getEventDisplayState(channelNumber);

//repaint();
}

void EventDisplayInterface::buttonClicked(Button* button)
{
checkEnabledState();
if (isEnabled)
{
display->setEventDisplayState(channelNumber, false);
}
else
{
display->setEventDisplayState(channelNumber, true);
}

repaint();

}

void EventDisplayInterface::paint(Graphics& g)
{

checkEnabledState();

if (isEnabled)
{
g.setColour(display->channelColours[channelNumber*2]);
g.fillRoundedRectangle(2,2,18,18,6.0f);
}

//g.drawText(String(channelNumber), 8, 2, 200, 15, Justification::left, false);

}

66 changes: 66 additions & 0 deletions Plugins/LfpDisplayNode/EventDisplayInterface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
------------------------------------------------------------------

This file is part of the Open Ephys GUI
Copyright (C) 2013 Open Ephys

------------------------------------------------------------------

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

*/
#ifndef __EVENTDISPLAYINTERFACE_H__
#define __EVENTDISPLAYINTERFACE_H__

#include <VisualizerWindowHeaders.h>

#include <vector>
#include <array>

#include "LfpDisplayClasses.h"
#include "LfpDisplayNode.h"
namespace LfpViewer {
#pragma mark - EventDisplayInterface -
//==============================================================================
/**
Interface class for Event Display channels.
*/
class EventDisplayInterface : public Component,
public Button::Listener
{
public:
EventDisplayInterface(LfpDisplay*, LfpDisplayCanvas*, int chNum);
~EventDisplayInterface();

void paint(Graphics& g);

void buttonClicked(Button* button);

void checkEnabledState();

bool isEnabled;

private:

int channelNumber;

LfpDisplay* display;
LfpDisplayCanvas* canvas;

ScopedPointer<UtilityButton> chButton;

};

}; // namespace
#endif
55 changes: 55 additions & 0 deletions Plugins/LfpDisplayNode/LfpBitmapPlotter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
------------------------------------------------------------------

This file is part of the Open Ephys GUI
Copyright (C) 2013 Open Ephys

------------------------------------------------------------------

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

*/
#ifndef __LFPBITMAPPLOTTER_H__
#define __LFPBITMAPPLOTTER_H__

#include <VisualizerWindowHeaders.h>

#include <vector>
#include <array>

#include "LfpDisplayClasses.h"
#include "LfpDisplayNode.h"
namespace LfpViewer {
#pragma mark - LfpBitmapPlotter -
//==============================================================================
/**
Interface class for different plotting methods.
*/
class LfpBitmapPlotter
{
public:
LfpBitmapPlotter(LfpDisplay * lfpDisplay)
: display(lfpDisplay)
{}
virtual ~LfpBitmapPlotter() {}

/** Plots one subsample of data from a single channel to the bitmap provided */
virtual void plot(Image::BitmapData &bitmapData, LfpBitmapPlotterInfo &plotterInfo) = 0;

protected:
LfpDisplay * display;
};

}; // namespace
#endif
61 changes: 61 additions & 0 deletions Plugins/LfpDisplayNode/LfpBitmapPlotterInfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
------------------------------------------------------------------

This file is part of the Open Ephys GUI
Copyright (C) 2013 Open Ephys

------------------------------------------------------------------

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

*/
#ifndef __LFPBITMAPPLOTTERINFO_H__
#define __LFPBITMAPPLOTTERINFO_H__

#include <VisualizerWindowHeaders.h>

#include <vector>
#include <array>

#include "LfpDisplayClasses.h"
#include "LfpDisplayNode.h"
namespace LfpViewer {
#pragma mark - LfpBitmapPlotterInfo -
//==============================================================================
/**
Information struct for plotting method encapsulation classes.
*/
struct LfpBitmapPlotterInfo
{
int channelID;
int samp;
int to;
int from;
int x;
int y;
int height;
int width;
float channelHeightFloat;
std::array<float, MAX_N_SAMP_PER_PIXEL> samplesPerPixel;
int sampleCountPerPixel;
float range;
int samplerange;
float histogramParameterA;
Colour lineColour;
Colour lineColourBright;
Colour lineColourDark;
};

}; // namespace
#endif
57 changes: 57 additions & 0 deletions Plugins/LfpDisplayNode/LfpChannelColourScheme.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
------------------------------------------------------------------

This file is part of the Open Ephys GUI
Copyright (C) 2013 Open Ephys

------------------------------------------------------------------

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

*/

#include "LfpChannelColourScheme.h"
#include "LfpDisplayNode.h"
#include "LfpDisplayCanvas.h"
#include "ShowHideOptionsButton.h"
#include "LfpDisplayOptions.h"
#include "LfpTimescale.h"
#include "LfpDisplay.h"
#include "LfpChannelDisplay.h"
#include "LfpChannelDisplayInfo.h"
#include "EventDisplayInterface.h"
#include "LfpViewport.h"
#include "LfpBitmapPlotterInfo.h"
#include "LfpBitmapPlotter.h"
#include "PerPixelBitmapPlotter.h"
#include "SupersampledBitmapPlotter.h"

#include <math.h>

using namespace LfpViewer;

#pragma mark - LfpChannelColourScheme -

int LfpChannelColourScheme::colourGrouping = 1;

void LfpChannelColourScheme::setColourGrouping(int grouping)
{
colourGrouping = grouping;
}

int LfpChannelColourScheme::getColourGrouping()
{
return colourGrouping;
}

Loading