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
c4728e1d
Commit
c4728e1d
authored
9 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Updated fslview_parseargs to align with DisplayOpts class hierarchy
changes, and a couple of other bugfixes.
parent
32f4bab9
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
fsl/fslview/displaycontext/display.py
+7
-8
7 additions, 8 deletions
fsl/fslview/displaycontext/display.py
fsl/fslview/displaycontext/volumeopts.py
+3
-14
3 additions, 14 deletions
fsl/fslview/displaycontext/volumeopts.py
fsl/tools/fslview_parseargs.py
+24
-27
24 additions, 27 deletions
fsl/tools/fslview_parseargs.py
with
34 additions
and
49 deletions
fsl/fslview/displaycontext/display.py
+
7
−
8
View file @
c4728e1d
...
...
@@ -18,9 +18,8 @@ import logging
import
props
import
fsl.data.image
as
fslimage
import
fsl.data.model
as
fslmodel
import
fsl.data.strings
as
strings
import
fsl.data.strings
as
strings
import
fsl.utils.typedict
as
td
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -222,11 +221,11 @@ import maskopts
import
modelopts
OVERLAY_TYPES
=
{
OVERLAY_TYPES
=
td
.
TypeDict
(
{
fslimage
.
Image
:
[
'
volume
'
,
'
mask
'
,
'
rgbvector
'
,
'
linevector
'
],
fslmodel
.
PolygonModel
:
[
'
model
'
]
}
'
Image
'
:
[
'
volume
'
,
'
mask
'
,
'
rgbvector
'
,
'
linevector
'
],
'
PolygonModel
'
:
[
'
model
'
]
}
)
"""
This dictionary provides a mapping between the overlay classes, and
the way in which they may be represented.
...
...
@@ -244,5 +243,5 @@ DISPLAY_OPTS_MAP = {
}
"""
This dictionary provides a mapping between each overlay type, and
the :class:`DisplayOpts` subclass which contains overlay type-specific
display options.
\
display options.
"""
This diff is collapsed.
Click to expand it.
fsl/fslview/displaycontext/volumeopts.py
+
3
−
14
View file @
c4728e1d
...
...
@@ -14,7 +14,6 @@ import numpy as np
import
props
import
fsl.data.image
as
fslimage
import
fsl.data.strings
as
strings
import
fsl.utils.transform
as
transform
import
fsl.fslview.colourmaps
as
fslcm
...
...
@@ -76,7 +75,7 @@ class ImageOpts(fsldisplay.DisplayOpts):
self
.
__setupTransforms
()
# is this a 4D volume?
if
self
.
is4D
():
if
self
.
overlay
.
is4DImage
():
self
.
setConstraint
(
'
volume
'
,
'
maxval
'
,
overlay
.
shape
[
3
]
-
1
)
self
.
addListener
(
'
transform
'
,
self
.
name
,
self
.
__transformChanged
)
...
...
@@ -108,7 +107,7 @@ class ImageOpts(fsldisplay.DisplayOpts):
"""
return
transform
.
axisBounds
(
self
.
__
overlay
.
shape
[:
3
],
self
.
getTransform
(
'
voxel
'
,
'
display
'
))
self
.
overlay
.
shape
[:
3
],
self
.
getTransform
(
'
voxel
'
,
'
display
'
))
def
__setupTransforms
(
self
):
...
...
@@ -118,13 +117,7 @@ class ImageOpts(fsldisplay.DisplayOpts):
These matrices are accessible via the :meth:`getTransform` method.
"""
# TODO This is obviously volumetric specific
if
not
isinstance
(
self
.
__overlay
,
fslimage
.
Image
):
log
.
warn
(
'
Non-volumetric types not supported yet
'
)
return
image
=
self
.
__overlay
image
=
self
.
overlay
voxToIdMat
=
np
.
eye
(
4
)
voxToPixdimMat
=
np
.
diag
(
list
(
image
.
pixdim
[:
3
])
+
[
1.0
])
...
...
@@ -178,10 +171,6 @@ class ImageOpts(fsldisplay.DisplayOpts):
value of :attr:`transform`.
"""
# TODO non-volumetric types
if
not
isinstance
(
self
.
__overlay
,
fslimage
.
Image
):
raise
RuntimeError
(
'
Non-volumetric types not supported yet
'
)
if
xform
is
None
:
xform
=
self
.
transform
...
...
This diff is collapsed.
Click to expand it.
fsl/tools/fslview_parseargs.py
+
24
−
27
View file @
c4728e1d
...
...
@@ -60,14 +60,7 @@ import fsl.utils.transform as transform
import
fsl.fslview.colourmaps
as
colourmaps
colourmaps
.
initColourMaps
()
import
fsl.fslview.displaycontext.display
as
fsldisplay
import
fsl.fslview.displaycontext.volumeopts
as
volumeopts
import
fsl.fslview.displaycontext.vectoropts
as
vectoropts
import
fsl.fslview.displaycontext.maskopts
as
maskopts
import
fsl.fslview.displaycontext.sceneopts
as
sceneopts
import
fsl.fslview.displaycontext.orthoopts
as
orthoopts
import
fsl.fslview.displaycontext.lightboxopts
as
lightboxopts
import
fsl.fslview.displaycontext
as
fsldisplay
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -113,14 +106,14 @@ OPTIONS = td.TypeDict({
# - so make sure transform is listed before
# interpolation!
'
Display
'
:
[
'
name
'
,
'
transform
'
,
'
overlayType
'
,
'
interpolation
'
,
'
resolution
'
,
'
volume
'
,
'
alpha
'
,
'
brightness
'
,
'
contrast
'
],
'
ImageOpts
'
:
[
'
transform
'
,
'
resolution
'
,
'
volume
'
],
'
VolumeOpts
'
:
[
'
displayRange
'
,
'
clippingRange
'
,
'
invert
'
,
...
...
@@ -147,6 +140,7 @@ GROUPNAMES = td.TypeDict({
'
LightBoxOpts
'
:
'
LightBox display options
'
,
'
Display
'
:
'
Overlay display options
'
,
'
ImageOpts
'
:
'
Image options
'
,
'
VolumeOpts
'
:
'
Volume options
'
,
'
VectorOpts
'
:
'
Vector options
'
,
'
MaskOpts
'
:
'
Mask options
'
,
...
...
@@ -197,14 +191,15 @@ ARGUMENTS = td.TypeDict({
'
Display.name
'
:
(
'
n
'
,
'
name
'
),
'
Display.interpolation
'
:
(
'
in
'
,
'
interp
'
),
'
Display.resolution
'
:
(
'
r
'
,
'
resolution
'
),
'
Display.transform
'
:
(
'
tf
'
,
'
transform
'
),
'
Display.overlayType
'
:
(
'
ot
'
,
'
overlayType
'
),
'
Display.volume
'
:
(
'
vl
'
,
'
volume
'
),
'
Display.alpha
'
:
(
'
a
'
,
'
alpha
'
),
'
Display.brightness
'
:
(
'
b
'
,
'
brightness
'
),
'
Display.contrast
'
:
(
'
c
'
,
'
contrast
'
),
'
ImageOpts.resolution
'
:
(
'
r
'
,
'
resolution
'
),
'
ImageOpts.transform
'
:
(
'
tf
'
,
'
transform
'
),
'
ImageOpts.volume
'
:
(
'
vl
'
,
'
volume
'
),
'
VolumeOpts.displayRange
'
:
(
'
dr
'
,
'
displayRange
'
),
'
VolumeOpts.clippingRange
'
:
(
'
cr
'
,
'
clippingRange
'
),
'
VolumeOpts.cmap
'
:
(
'
cm
'
,
'
cmap
'
),
...
...
@@ -271,14 +266,16 @@ HELP = td.TypeDict({
'
Display.name
'
:
'
Overlay name
'
,
'
Display.interpolation
'
:
'
Interpolation
'
,
'
Display.resolution
'
:
'
Resolution
'
,
'
Display.transform
'
:
'
Transformation
'
,
'
Display.overlayType
'
:
'
Overlay type
'
,
'
Display.volume
'
:
'
Volume
'
,
'
Display.alpha
'
:
'
Opacity
'
,
'
Display.brightness
'
:
'
Brightness
'
,
'
Display.contrast
'
:
'
Contrast
'
,
'
ImageOpts.resolution
'
:
'
Resolution
'
,
'
ImageOpts.transform
'
:
'
Transformation
'
,
'
ImageOpts.volume
'
:
'
Volume
'
,
'
VolumeOpts.displayRange
'
:
'
Display range
'
,
'
VolumeOpts.clippingRange
'
:
'
Clipping range
'
,
'
VolumeOpts.cmap
'
:
'
Colour map
'
,
...
...
@@ -411,7 +408,7 @@ def _configSceneParser(sceneParser):
"""
Adds options to the given argument parser which allow
the user to specify colour bar properties.
"""
_configParser
(
sceneopts
.
SceneOpts
,
sceneParser
)
_configParser
(
fsldisplay
.
SceneOpts
,
sceneParser
)
def
_configOrthoParser
(
orthoParser
):
...
...
@@ -419,7 +416,7 @@ def _configOrthoParser(orthoParser):
configure an orthographic display.
"""
OrthoOpts
=
orthoopts
.
OrthoOpts
OrthoOpts
=
fsldisplay
.
OrthoOpts
_configParser
(
OrthoOpts
,
orthoParser
)
# Extra configuration options that are
...
...
@@ -446,7 +443,7 @@ def _configLightBoxParser(lbParser):
"""
Adds options to the given parser allowing the user to
configure a lightbox display.
"""
_configParser
(
lightboxopts
.
LightBoxOpts
,
lbParser
)
_configParser
(
fsldisplay
.
LightBoxOpts
,
lbParser
)
def
_configOverlayParser
(
ovlParser
):
...
...
@@ -455,9 +452,9 @@ def _configOverlayParser(ovlParser):
"""
Display
=
fsldisplay
.
Display
VolumeOpts
=
volumeopts
.
VolumeOpts
VectorOpts
=
vectoropts
.
VectorOpts
MaskOpts
=
maskopts
.
MaskOpts
VolumeOpts
=
fsldisplay
.
VolumeOpts
VectorOpts
=
fsldisplay
.
VectorOpts
MaskOpts
=
fsldisplay
.
MaskOpts
dispDesc
=
'
Each display option will be applied to the
'
\
'
overlay which is listed before that option.
'
...
...
@@ -617,7 +614,7 @@ def parseArgs(mainParser, argv, name, desc, toolOptsDesc='[options]'):
# the user to specify another image file
# by which the vector image colours are
# to be modulated
fileOpts
.
append
(
ARGUMENTS
[
vectoropts
.
VectorOpts
,
'
modulate
'
])
fileOpts
.
append
(
ARGUMENTS
[
fsldisplay
.
VectorOpts
,
'
modulate
'
])
# There is a possibility that the user
# may specify an overlay name which is the
...
...
@@ -807,8 +804,8 @@ def generateSceneArgs(overlayList, displayCtx, sceneOpts):
args
+=
[
'
--{}
'
.
format
(
ARGUMENTS
[
'
Main.scene
'
][
1
])]
if
isinstance
(
sceneOpts
,
orthoopts
.
OrthoOpts
):
args
+=
[
'
ortho
'
]
elif
isinstance
(
sceneOpts
,
lightboxopts
.
LightBoxOpts
):
args
+=
[
'
lightbox
'
]
if
isinstance
(
sceneOpts
,
fsldisplay
.
OrthoOpts
):
args
+=
[
'
ortho
'
]
elif
isinstance
(
sceneOpts
,
fsldisplay
.
LightBoxOpts
):
args
+=
[
'
lightbox
'
]
else
:
raise
ValueError
(
'
Unrecognised SceneOpts
'
'
type: {}
'
.
format
(
type
(
sceneOpts
).
__name__
))
...
...
@@ -898,7 +895,7 @@ def applyOverlayArgs(args, overlayList, displayCtx, **kwargs):
# value. If the modulate file is not valid,
# I print a warning, and clear the modulate
# option.
if
isinstance
(
opts
,
vectoropts
.
VectorOpts
)
and
\
if
isinstance
(
opts
,
fsldisplay
.
VectorOpts
)
and
\
isinstance
(
overlay
,
fslimage
.
Image
)
and
\
args
.
overlays
[
i
].
modulate
is
not
None
:
...
...
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