Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Michiel Cottaar
fslpy
Commits
8133eaf1
Commit
8133eaf1
authored
9 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Plot panel supports screenshots
parent
21129814
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fsl/data/strings.py
+1
-0
1 addition, 0 deletions
fsl/data/strings.py
fsl/fslview/views/plotpanel.py
+31
-4
31 additions, 4 deletions
fsl/fslview/views/plotpanel.py
with
32 additions
and
4 deletions
fsl/data/strings.py
+
1
−
0
View file @
8133eaf1
...
@@ -64,6 +64,7 @@ messages = TypeDict({
...
@@ -64,6 +64,7 @@ messages = TypeDict({
'
not four dimensional
'
,
'
not four dimensional
'
,
'
TimeSeriesPanel.outOfBounds
'
:
'
Selected overlay has no data
'
'
TimeSeriesPanel.outOfBounds
'
:
'
Selected overlay has no data
'
'
at the current coordinates
'
,
'
at the current coordinates
'
,
'
TimeSeriesPanel.screenshot
'
:
'
Save screenshot
'
,
'
SpacePanel.nonVolumetric
'
:
'
Non-volumetric overlays
'
'
SpacePanel.nonVolumetric
'
:
'
Non-volumetric overlays
'
'
are not supported
'
,
'
are not supported
'
,
...
...
This diff is collapsed.
Click to expand it.
fsl/fslview/views/plotpanel.py
+
31
−
4
View file @
8133eaf1
...
@@ -7,16 +7,23 @@
...
@@ -7,16 +7,23 @@
import
logging
import
logging
import
wx
import
matplotlib
as
mpl
import
matplotlib
as
mpl
import
numpy
as
np
mpl
.
use
(
'
WxAgg
'
)
mpl
.
use
(
'
WxAgg
'
)
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
import
matplotlib.image
as
mplimg
from
matplotlib.backends.backend_wxagg
import
FigureCanvasWxAgg
as
Canvas
from
matplotlib.backends.backend_wxagg
import
FigureCanvasWxAgg
as
Canvas
from
mpl_toolkits.mplot3d
import
Axes3D
from
mpl_toolkits.mplot3d
import
Axes3D
import
viewpanel
import
viewpanel
import
fsl.data.strings
as
strings
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
...
@@ -41,7 +48,7 @@ class PlotPanel(viewpanel.ViewPanel):
...
@@ -41,7 +48,7 @@ class PlotPanel(viewpanel.ViewPanel):
# There is currently no screenshot functionality
# There is currently no screenshot functionality
# because I haven't gotten around to implementing
# because I haven't gotten around to implementing
# it ...
# it ...
self
.
disable
(
'
screenshot
'
)
#
self.disable('screenshot')
self
.
__figure
=
plt
.
Figure
()
self
.
__figure
=
plt
.
Figure
()
self
.
__axis
=
self
.
__figure
.
add_subplot
(
111
,
projection
=
proj
)
self
.
__axis
=
self
.
__figure
.
add_subplot
(
111
,
projection
=
proj
)
...
@@ -67,7 +74,27 @@ class PlotPanel(viewpanel.ViewPanel):
...
@@ -67,7 +74,27 @@ class PlotPanel(viewpanel.ViewPanel):
def
screenshot
(
self
,
*
a
):
def
screenshot
(
self
,
*
a
):
pass
dlg
=
wx
.
FileDialog
(
self
,
message
=
strings
.
messages
[
self
,
'
screenshot
'
],
style
=
wx
.
FD_SAVE
)
if
dlg
.
ShowModal
()
!=
wx
.
ID_OK
:
return
path
=
dlg
.
GetPath
()
buf
=
self
.
__canvas
.
tostring_argb
()
ncols
,
nrows
=
self
.
__canvas
.
get_width_height
()
bitmap
=
np
.
fromstring
(
buf
,
dtype
=
np
.
uint8
)
bitmap
=
bitmap
.
reshape
(
nrows
,
ncols
,
4
)
rgb
=
bitmap
[:,
:,
1
:]
a
=
bitmap
[:,
:,
0
]
bitmap
=
np
.
dstack
((
rgb
,
a
))
mplimg
.
imsave
(
path
,
bitmap
)
def
message
(
self
,
msg
):
def
message
(
self
,
msg
):
...
...
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