Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
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
FSL
fslpy
Commits
12f57691
Commit
12f57691
authored
10 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TimeSeriesPanel changes imagelist volume on mouse clicks/drags
parent
c00cf46b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/fslview/views/timeseriespanel.py
+54
-7
54 additions, 7 deletions
fsl/fslview/views/timeseriespanel.py
with
54 additions
and
7 deletions
fsl/fslview/views/timeseriespanel.py
+
54
−
7
View file @
12f57691
...
...
@@ -12,6 +12,7 @@ import wx
import
props
import
numpy
as
np
import
matplotlib
as
mpl
mpl
.
use
(
'
WXAgg
'
)
...
...
@@ -31,9 +32,19 @@ class TimeSeriesPanel(wx.Panel, props.HasProperties):
self
.
_name
=
'
{}_{}
'
.
format
(
self
.
__class__
.
__name__
,
id
(
self
))
self
.
_figure
=
plt
.
Figure
()
self
.
_axis
=
self
.
_figure
.
add_subplot
(
1
,
1
,
1
)
self
.
_axis
=
self
.
_figure
.
add_subplot
(
1
1
1
)
self
.
_canvas
=
Canvas
(
self
,
-
1
,
self
.
_figure
)
self
.
_figure
.
subplots_adjust
(
top
=
1.0
,
bottom
=
0.0
,
left
=
0.0
,
right
=
1.0
)
self
.
_figure
.
patch
.
set_visible
(
False
)
self
.
_mouseDown
=
False
self
.
_canvas
.
mpl_connect
(
'
button_press_event
'
,
self
.
_onPlotMouseDown
)
self
.
_canvas
.
mpl_connect
(
'
button_release_event
'
,
self
.
_onPlotMouseUp
)
self
.
_canvas
.
mpl_connect
(
'
motion_notify_event
'
,
self
.
_onPlotMouseMove
)
self
.
_sizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
self
.
SetSizer
(
self
.
_sizer
)
self
.
_sizer
.
Add
(
self
.
_canvas
,
flag
=
wx
.
EXPAND
,
proportion
=
1
)
...
...
@@ -105,10 +116,11 @@ class TimeSeriesPanel(wx.Panel, props.HasProperties):
if
vox
>=
shape
or
vox
<
0
:
inBounds
=
False
if
inBounds
:
data
=
image
.
data
[
x
,
y
,
z
,
:]
self
.
_axis
.
plot
(
data
,
'
r-
'
,
lw
=
2
)
else
:
if
t
<
image
.
shape
[
3
]:
self
.
_axis
.
axvline
(
t
,
lw
=
2
,
c
=
'
#000080
'
,
alpha
=
0.6
)
if
not
inBounds
:
self
.
_axis
.
text
(
0.5
,
0.5
,
...
...
@@ -117,7 +129,42 @@ class TimeSeriesPanel(wx.Panel, props.HasProperties):
ha
=
'
center
'
,
transform
=
self
.
_axis
.
transAxes
)
if
t
<
image
.
shape
[
3
]:
self
.
_axis
.
axvline
(
t
,
lw
=
2
,
c
=
'
#000080
'
)
data
=
image
.
data
[
x
,
y
,
z
,
:]
self
.
_axis
.
plot
(
data
,
'
r-
'
,
lw
=
2
)
xmin
=
0
xmax
=
image
.
shape
[
3
]
ymin
=
data
.
min
()
ymax
=
data
.
max
()
xlen
=
xmax
-
xmin
ylen
=
ymax
-
ymin
self
.
_axis
.
grid
(
True
)
self
.
_axis
.
set_xlim
((
xmin
-
xlen
*
0.05
,
xmax
+
xlen
*
0.05
))
self
.
_axis
.
set_ylim
((
ymin
-
ylen
*
0.05
,
ymax
+
ylen
*
0.05
))
yticks
=
np
.
linspace
(
ymin
,
ymax
,
5
)
self
.
_axis
.
set_yticks
(
yticks
)
for
tick
in
self
.
_axis
.
yaxis
.
get_major_ticks
():
tick
.
set_pad
(
-
15
)
tick
.
label1
.
set_horizontalalignment
(
'
left
'
)
for
tick
in
self
.
_axis
.
xaxis
.
get_major_ticks
():
tick
.
set_pad
(
-
20
)
self
.
_canvas
.
draw
()
self
.
Refresh
()
def
_onPlotMouseDown
(
self
,
ev
):
self
.
_mouseDown
=
True
def
_onPlotMouseUp
(
self
,
ev
):
self
.
_mouseDown
=
False
def
_onPlotMouseMove
(
self
,
ev
):
if
not
self
.
_mouseDown
:
return
if
ev
.
inaxes
!=
self
.
_axis
:
return
self
.
_imageList
.
volume
=
np
.
floor
(
ev
.
xdata
)
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