Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
plugin-GUI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
yehaojie
plugin-GUI
Commits
5da98625
Commit
5da98625
authored
13 years ago
by
Stuart Layton
Browse files
Options
Downloads
Patches
Plain Diff
removed old SpikeViewer source and header file
parent
c3df4359
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/Processors/Visualization/SpikeViewer.cpp
+0
-340
0 additions, 340 deletions
Source/Processors/Visualization/SpikeViewer.cpp
Source/Processors/Visualization/SpikeViewer.h
+0
-91
0 additions, 91 deletions
Source/Processors/Visualization/SpikeViewer.h
with
0 additions
and
431 deletions
Source/Processors/Visualization/SpikeViewer.cpp
deleted
100644 → 0
+
0
−
340
View file @
c3df4359
/*
------------------------------------------------------------------
This file is part of the Open Ephys GUI
Copyright (C) 2012 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
"SpikeViewer.h"
SpikeViewer
::
SpikeViewer
(
AudioSampleBuffer
*
sBuffer
,
MidiBuffer
*
eBuffer
,
UIComponent
*
ui
)
:
Renderer
(
sBuffer
,
eBuffer
,
ui
)
{
}
SpikeViewer
::~
SpikeViewer
()
{}
void
SpikeViewer
::
resized
()
{
xBox
=
getWidth
()
/
4
;
yBox
=
getHeight
()
/
2
;
yPadding
=
5
;
xPadding
=
5
;
glClear
(
GL_COLOR_BUFFER_BIT
);
clearWaveforms
();
clearProjections
();
}
void
SpikeViewer
::
newOpenGLContextCreated
()
{
glClearDepth
(
1.0
);
glMatrixMode
(
GL_PROJECTION
);
glLoadIdentity
();
glOrtho
(
0
,
1
,
1
,
0
,
0
,
1
);
glMatrixMode
(
GL_MODELVIEW
);
glClearColor
(
0.2
f
,
0.2
f
,
0.2
f
,
1.0
f
);
resized
();
glFlush
();
}
void
SpikeViewer
::
clearWaveforms
()
{
for
(
int
n
=
0
;
n
<
4
;
n
++
)
{
setViewportForWaveN
(
n
);
drawBorder
();
}
}
void
SpikeViewer
::
clearProjections
()
{
for
(
int
n
=
0
;
n
<
6
;
n
++
)
{
setViewportForProjectionN
(
n
);
drawBorder
();
}
}
void
SpikeViewer
::
renderOpenGL
()
{
if
(
eventBuffer
->
getNumEvents
()
>
0
)
{
glRasterPos2f
(
0.1
,
0.1
);
//const char* str = "i";
// void* font = GLUT_BITMAP_8_BY_13;
// glutBitmapCharacter(font,54);
// drawBorder();
//std::cout << "Events received by Spike Viewer." << std::endl;
MidiBuffer
::
Iterator
i
(
*
eventBuffer
);
MidiMessage
message
(
0xf4
);
int
samplePosition
;
i
.
setNextSamplePosition
(
samplePosition
);
//Array<int> peaks;
clearWaveforms
();
while
(
i
.
getNextEvent
(
message
,
samplePosition
))
{
int
numbytes
=
message
.
getRawDataSize
();
int
numSamples
=
(
numbytes
-
2
)
/
2
;
uint8
*
dataptr
=
message
.
getRawData
();
int
chan
=
(
*
dataptr
<<
8
)
+
*
(
dataptr
+
1
);
int
electrode
=
config
->
getSource
(
0
)
->
getElectrodeNumberForChannel
(
chan
);
//std::cout << chan << "::" << electrode << std::endl;
dataptr
+=
2
;
//glViewport(0,0,getWidth()/2,getHeight());
if
(
electrode
==
0
)
{
//for (int n = 0; n < 4; n++) {
setViewportForWaveN
(
chan
);
float
peak
=
drawWaveform
(
dataptr
,
numSamples
);
peaks
.
set
(
chan
,
peak
*
1.25
);
//peaks.set(chan,peak);
}
if
(
peaks
.
size
()
==
4
)
{
drawProjections
();
peaks
.
clear
();
}
//std::cout << " Bytes received: " << numbytes << std::endl;
//std::cout << " Message timestamp = " << message.getTimeStamp() << std::endl;
//std::cout << " Message channel: " << chan << std::endl;
//std::cout << " ";
//AudioDataConverters::convertInt16BEToFloat ( dataptr, // source
// spikeData, // dest
// numSamples, // numSamples
// 2 ); // destBytesPerSample = 2
//for (int n = 0; n < numSamples; n++) {
// std::cout << String(spikeData[n]) << " ";
//}
//std::cout << std::endl << std::endl;
}
// for (int ch = 0; ch < 4; ch++)
// {
// }
//eventBuffer->clear();
}
//glOrtho(0, 0.5, 0.5, 0, 0, 1);
glFlush
();
}
void
SpikeViewer
::
drawProjections
()
{
for
(
int
i
=
0
;
i
<
6
;
i
++
)
{
setViewportForProjectionN
(
i
);
int
d1
,
d2
;
if
(
i
==
0
){
d1
=
0
;
d2
=
1
;
}
else
if
(
i
==
1
)
{
d1
=
0
;
d2
=
2
;
}
else
if
(
i
==
2
)
{
d1
=
0
;
d2
=
3
;
}
else
if
(
i
==
3
)
{
d1
=
1
;
d2
=
2
;
}
else
if
(
i
==
4
)
{
d1
=
1
;
d2
=
3
;
}
else
if
(
i
==
5
)
{
d1
=
2
;
d2
=
3
;
}
glColor3f
(
0.0
,
0.0
,
0.0
);
glBegin
(
GL_POINTS
);
glVertex2f
(
1
-
peaks
[
d1
],
peaks
[
d2
]);
glEnd
();
}
}
float
SpikeViewer
::
drawWaveform
(
uint8
*
dataptr
,
int
numSamples
)
{
glColor3f
(
0
,
0.0
,
0
);
glBegin
(
GL_LINE_STRIP
);
float
maxVal
=
0
;
for
(
int
n
=
0
;
n
<
numSamples
;
n
++
)
{
uint16
sampleValue
=
(
*
dataptr
<<
8
)
+
*
(
dataptr
+
1
);
float
sampleVal
=
-
float
(
sampleValue
-
32768
)
/
32768
+
0.6
;
(
sampleVal
>
maxVal
)
?
maxVal
=
sampleVal
:
maxVal
=
maxVal
;
glVertex2f
(
float
(
n
)
/
numSamples
+
0.01
,
sampleVal
);
dataptr
+=
2
;
}
glEnd
();
return
maxVal
;
}
void
SpikeViewer
::
drawBorder
()
{
glColor3f
(
0.9
,
0.7
,
0.2
);
glRectf
(
0.01
f
,
0.01
f
,
0.99
f
,
0.99
f
);
// glBegin(GL_LINE_STRIP);
// glVertex2f(0.01f, 0.01f);
// glVertex2f(0.99f, 0.01f);
// glVertex2f(0.99f, 0.99f);
// glVertex2f(0.01f, 0.99f);
// glVertex2f(0.01f, 0.01f);
// glEnd();
}
void
SpikeViewer
::
setViewportForProjectionN
(
int
n
)
{
// std::cout<<"Setting viewport on projection:"<<n<<std::endl;
float
viewDX
=
xBox
;
float
viewDY
=
yBox
;
float
viewX
,
viewY
;
switch
(
n
){
case
0
:
viewX
=
xBox
;
viewY
=
yBox
;
break
;
case
1
:
viewX
=
xBox
*
2
;
viewY
=
yBox
;
break
;
case
2
:
viewX
=
xBox
*
3
;
viewY
=
yBox
;
break
;
case
3
:
viewX
=
xBox
;
viewY
=
0
;
break
;
case
4
:
viewX
=
xBox
*
2
;
viewY
=
0
;
break
;
case
5
:
viewX
=
xBox
*
3
;
viewY
=
0
;
break
;
default:
std
::
cout
<<
"drawing of more than 4 channels is not supported, returning! Requested:"
<<
n
<<
std
::
endl
;
return
;
}
viewX
=
viewX
+
xPadding
;
viewY
=
viewY
+
yPadding
;
viewDX
=
viewDX
-
2
*
xPadding
;
viewDY
=
viewDY
-
2
*
yPadding
;
glViewport
(
viewX
,
viewY
,
viewDX
,
viewDY
);
}
void
SpikeViewer
::
setViewportForWaveN
(
int
n
){
float
viewDX
=
xBox
/
2
;
float
viewDY
=
yBox
;
float
viewX
,
viewY
;
switch
(
n
){
case
0
:
viewX
=
0
;
viewY
=
yBox
;
break
;
case
1
:
viewX
=
xBox
/
2
;
viewY
=
yBox
;
break
;
case
2
:
viewX
=
0
;
viewY
=
0
;
break
;
case
3
:
viewX
=
xBox
/
2
;
viewY
=
0
;
break
;
default:
std
::
cout
<<
"drawing of more than 4 channels is not supported, returning! Requested:"
<<
n
<<
std
::
endl
;
return
;
}
viewX
=
viewX
+
xPadding
;
viewY
=
viewY
+
yPadding
;
viewDX
=
viewDX
-
2
*
xPadding
;
viewDY
=
viewDY
-
2
*
yPadding
;
glViewport
(
viewX
,
viewY
,
viewDX
,
viewDY
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Source/Processors/Visualization/SpikeViewer.h
deleted
100644 → 0
+
0
−
91
View file @
c3df4359
/*
------------------------------------------------------------------
This file is part of the Open Ephys GUI
Copyright (C) 2012 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 __SPIKEVIEWER_H_AF442416__
#define __SPIKEVIEWER_H_AF442416__
#include
"../../../JuceLibraryCode/JuceHeader.h"
#include
"../Editors/Visualizer.h"
#ifdef _WIN32
#include
<windows.h>
#endif
#if JUCE_WINDOWS
#include
<gl/gl.h>
#include
<gl/glu.h>
#elif JUCE_LINUX
#include
<GL/gl.h>
#include
<GL/glut.h>
#undef KeyPress
#elif JUCE_IPHONE
#include
<OpenGLES/ES1/gl.h>
#include
<OpenGLES/ES1/glext.h>
#elif JUCE_MAC
#include
<GLUT/glut.h>
#endif
#ifndef GL_BGRA_EXT
#define GL_BGRA_EXT 0x80e1
#endif
/**
--THIS FILE IS OBSOLETE, BUT REMAINS FOR REFERENCE PURPOSES--
*/
class
SpikeViewer
:
public
Renderer
{
public:
SpikeViewer
(
AudioSampleBuffer
*
streamBuffer
,
MidiBuffer
*
eventBuffer
,
UIComponent
*
ui
);
~
SpikeViewer
();
void
renderOpenGL
();
void
newOpenGLContextCreated
();
//void setViewportForProjection
private:
int
nTrodes
;
Array
<
float
>
peaks
;
float
xBox
,
yBox
,
xPadding
,
yPadding
;
void
drawBorder
();
void
clearWaveforms
();
void
clearProjections
();
void
drawProjections
();
float
drawWaveform
(
uint8
*
dataptr
,
int
numSamples
);
void
setViewportForWaveN
(
int
n
);
void
setViewportForProjectionN
(
int
n
);
void
resized
();
};
#endif // __SPIKEVIEWER_H_AF442416__
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment