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
5402ecfd
Commit
5402ecfd
authored
11 years ago
by
jvoigts
Browse files
Options
Downloads
Patches
Plain Diff
Added UI for grouping lfp channel colors
parent
b6c4d733
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/LfpDisplayCanvas.cpp
+63
-5
63 additions, 5 deletions
Source/Processors/Visualization/LfpDisplayCanvas.cpp
Source/Processors/Visualization/LfpDisplayCanvas.h
+9
-1
9 additions, 1 deletion
Source/Processors/Visualization/LfpDisplayCanvas.h
with
72 additions
and
6 deletions
Source/Processors/Visualization/LfpDisplayCanvas.cpp
+
63
−
5
View file @
5402ecfd
...
...
@@ -82,6 +82,12 @@ LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
spreads
.
add
(
"50"
);
spreads
.
add
(
"60"
);
colorGroupings
.
add
(
"1"
);
colorGroupings
.
add
(
"2"
);
colorGroupings
.
add
(
"4"
);
colorGroupings
.
add
(
"8"
);
colorGroupings
.
add
(
"16"
);
rangeSelection
=
new
ComboBox
(
"Voltage range"
);
rangeSelection
->
addItemList
(
voltageRanges
,
1
);
...
...
@@ -102,6 +108,12 @@ LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
spreadSelection
->
addListener
(
this
);
addAndMakeVisible
(
spreadSelection
);
colorGroupingSelection
=
new
ComboBox
(
"Color Grouping"
);
colorGroupingSelection
->
addItemList
(
colorGroupings
,
1
);
colorGroupingSelection
->
setSelectedId
(
1
,
false
);
colorGroupingSelection
->
addListener
(
this
);
addAndMakeVisible
(
colorGroupingSelection
);
lfpDisplay
->
setNumChannels
(
nChans
);
lfpDisplay
->
setRange
(
1000.0
f
);
...
...
@@ -140,6 +152,8 @@ void LfpDisplayCanvas::resized()
rangeSelection
->
setBounds
(
5
,
getHeight
()
-
30
,
100
,
25
);
timebaseSelection
->
setBounds
(
175
,
getHeight
()
-
30
,
100
,
25
);
spreadSelection
->
setBounds
(
345
,
getHeight
()
-
30
,
100
,
25
);
colorGroupingSelection
->
setBounds
(
620
,
getHeight
()
-
30
,
100
,
25
);
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
...
...
@@ -220,11 +234,16 @@ void LfpDisplayCanvas::comboBoxChanged(ComboBox* cb)
resized
();
//std::cout << "Setting spread to " << spreads[cb->getSelectedId()-1].getFloatValue() << std::endl;
}
else
if
(
cb
==
colorGroupingSelection
)
{
// set color grouping hre
timescale
->
setTimebase
(
timebase
);
}
lfpDisplay
->
setColorGrouping
(
colorGroupings
[
cb
->
getSelectedId
()
-
1
].
getIntValue
());
// so that channel colors get re-assigned
}
timescale
->
setTimebase
(
timebase
);
}
int
LfpDisplayCanvas
::
getChannelHeight
()
...
...
@@ -424,8 +443,10 @@ void LfpDisplayCanvas::paint(Graphics& g)
g
.
drawText
(
"Voltage range (uV)"
,
5
,
getHeight
()
-
55
,
300
,
20
,
Justification
::
left
,
false
);
g
.
drawText
(
"Timebase (s)"
,
175
,
getHeight
()
-
55
,
300
,
20
,
Justification
::
left
,
false
);
g
.
drawText
(
"Spread (px)"
,
345
,
getHeight
()
-
55
,
300
,
20
,
Justification
::
left
,
false
);
g
.
drawText
(
"Color grouping"
,
620
,
getHeight
()
-
55
,
300
,
20
,
Justification
::
left
,
false
);
g
.
drawText
(
"Event disp
lay
"
,
500
,
getHeight
()
-
55
,
300
,
20
,
Justification
::
left
,
false
);
g
.
drawText
(
"Event disp
.
"
,
500
,
getHeight
()
-
55
,
300
,
20
,
Justification
::
left
,
false
);
...
...
@@ -450,6 +471,8 @@ void LfpDisplayCanvas::saveVisualizerParameters(XmlElement* xml)
xmlNode
->
setAttribute
(
"Range"
,
rangeSelection
->
getSelectedId
());
xmlNode
->
setAttribute
(
"Timebase"
,
timebaseSelection
->
getSelectedId
());
xmlNode
->
setAttribute
(
"Spread"
,
spreadSelection
->
getSelectedId
());
xmlNode
->
setAttribute
(
"colorGrouping"
,
colorGroupingSelection
->
getSelectedId
());
int
eventButtonState
=
0
;
...
...
@@ -491,6 +514,11 @@ void LfpDisplayCanvas::loadVisualizerParameters(XmlElement* xml)
rangeSelection
->
setSelectedId
(
xmlNode
->
getIntAttribute
(
"Range"
));
timebaseSelection
->
setSelectedId
(
xmlNode
->
getIntAttribute
(
"Timebase"
));
spreadSelection
->
setSelectedId
(
xmlNode
->
getIntAttribute
(
"Spread"
));
if
(
xmlNode
->
hasAttribute
(
"colorGrouping"
))
{
colorGroupingSelection
->
setSelectedId
(
xmlNode
->
getIntAttribute
(
"colorGrouping"
));
}
else
{
colorGroupingSelection
->
setSelectedId
(
1
);
}
viewport
->
setViewPosition
(
xmlNode
->
getIntAttribute
(
"ScrollX"
),
xmlNode
->
getIntAttribute
(
"ScrollY"
));
...
...
@@ -585,6 +613,7 @@ LfpDisplay::LfpDisplay(LfpDisplayCanvas* c, Viewport* v) :
{
totalHeight
=
0
;
colorGrouping
=
1
;
addMouseListener
(
this
,
true
);
...
...
@@ -620,12 +649,27 @@ LfpDisplay::~LfpDisplay()
}
int
LfpDisplay
::
getNumChannels
()
{
return
numChans
;
}
int
LfpDisplay
::
getColorGrouping
()
{
return
colorGrouping
;
}
void
LfpDisplay
::
setColorGrouping
(
int
i
)
{
colorGrouping
=
i
;
setColors
();
// so that channel colors get re-assigned
}
void
LfpDisplay
::
setNumChannels
(
int
numChannels
)
{
numChans
=
numChannels
;
...
...
@@ -644,7 +688,7 @@ void LfpDisplay::setNumChannels(int numChannels)
LfpChannelDisplay
*
lfpChan
=
new
LfpChannelDisplay
(
canvas
,
this
,
i
);
lfpChan
->
setColour
(
channelColours
[
i
%
channelColours
.
size
()]);
//
lfpChan->setColour(channelColours[i % channelColours.size()]);
lfpChan
->
setRange
(
range
);
lfpChan
->
setChannelHeight
(
canvas
->
getChannelHeight
());
...
...
@@ -654,7 +698,7 @@ void LfpDisplay::setNumChannels(int numChannels)
LfpChannelDisplayInfo
*
lfpInfo
=
new
LfpChannelDisplayInfo
(
canvas
,
this
,
i
);
lfpInfo
->
setColour
(
channelColours
[
i
%
channelColours
.
size
()]);
//
lfpInfo->setColour(channelColours[i % channelColours.size()]);
lfpInfo
->
setRange
(
range
);
lfpInfo
->
setChannelHeight
(
canvas
->
getChannelHeight
());
...
...
@@ -666,6 +710,8 @@ void LfpDisplay::setNumChannels(int numChannels)
}
setColors
();
//std::cout << "TOTAL HEIGHT = " << totalHeight << std::endl;
// // this doesn't seem to do anything:
...
...
@@ -674,6 +720,18 @@ void LfpDisplay::setNumChannels(int numChannels)
}
void
LfpDisplay
::
setColors
()
{
for
(
int
i
=
0
;
i
<
numChans
;
i
++
)
{
channels
[
i
]
->
setColour
(
channelColours
[(
int
(
i
/
colorGrouping
)
+
1
)
%
channelColours
.
size
()]);
channelInfo
[
i
]
->
setColour
(
channelColours
[(
int
(
i
/
colorGrouping
)
+
1
)
%
channelColours
.
size
()]);
}
}
int
LfpDisplay
::
getTotalHeight
()
{
return
totalHeight
;
...
...
This diff is collapsed.
Click to expand it.
Source/Processors/Visualization/LfpDisplayCanvas.h
+
9
−
1
View file @
5402ecfd
...
...
@@ -55,7 +55,6 @@ public:
void
endAnimation
();
void
refreshState
();
void
update
();
void
setParameter
(
int
,
float
);
...
...
@@ -95,6 +94,7 @@ private:
float
displayGain
;
float
timeOffset
;
//int spread ; // vertical spacing between channels
static
const
int
MAX_N_CHAN
=
256
;
// maximum number of channels
static
const
int
MAX_N_SAMP
=
5000
;
// maximum display size in pixels
...
...
@@ -112,10 +112,12 @@ private:
ScopedPointer
<
ComboBox
>
timebaseSelection
;
ScopedPointer
<
ComboBox
>
rangeSelection
;
ScopedPointer
<
ComboBox
>
spreadSelection
;
ScopedPointer
<
ComboBox
>
colorGroupingSelection
;
StringArray
voltageRanges
;
StringArray
timebases
;
StringArray
spreads
;
// option for vertical spacing between channels
StringArray
colorGroupings
;
// option for coloring every N channels the same
OwnedArray
<
EventDisplayInterface
>
eventDisplayInterfaces
;
...
...
@@ -182,10 +184,14 @@ public:
void
setChannelHeight
(
int
r
);
int
getChannelHeight
();
void
setColors
();
bool
setEventDisplayState
(
int
ch
,
bool
state
);
bool
getEventDisplayState
(
int
ch
);
int
getColorGrouping
();
void
setColorGrouping
(
int
i
);
void
setEnabledState
(
bool
,
int
);
bool
getEnabledState
(
int
);
void
enableChannel
(
bool
,
int
);
...
...
@@ -202,6 +208,8 @@ private:
int
totalHeight
;
int
colorGrouping
;
LfpDisplayCanvas
*
canvas
;
Viewport
*
viewport
;
...
...
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