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
8ccc4c8b
Commit
8ccc4c8b
authored
10 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Slice Spacing is now bounded. Slice spacing and zrange are basically
reset whenever the image bounds or Z axis is changed.
parent
a2a2b711
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/gl/lightboxcanvas.py
+21
-20
21 additions, 20 deletions
fsl/fslview/gl/lightboxcanvas.py
with
21 additions
and
20 deletions
fsl/fslview/gl/lightboxcanvas.py
+
21
−
20
View file @
8ccc4c8b
...
...
@@ -29,7 +29,10 @@ class LightBoxCanvas(slicecanvas.SliceCanvas):
"""
sliceSpacing
=
props
.
Real
(
clamped
=
True
,
minval
=
0.1
,
default
=
1.0
)
sliceSpacing
=
props
.
Real
(
clamped
=
True
,
minval
=
0.1
,
maxval
=
30.0
,
default
=
1.0
)
"""
This property controls the spacing
between slices (in real world coordinates).
"""
...
...
@@ -293,19 +296,28 @@ class LightBoxCanvas(slicecanvas.SliceCanvas):
# and make sure that row is visible
self
.
topRow
=
row
def
_zAxisChanged
(
self
,
*
a
):
def
_imageListChanged
(
self
,
*
a
):
"""
Overrides
:meth:`fsl.fslview.gl.slicecanvas.SliceCanvas._
zAx
isChanged`.
:meth:`
~
fsl.fslview.gl.slicecanvas.SliceCanvas._
imageL
is
t
Changed`.
Called when the :attr:`~fsl.fslview.SliceCanvas.zax` property
changes. Calls the superclass implementation, and then sets the slice
:attr:`zrange` bounds to the image bounds.
Regenerates slice locations for all images, and calls the super
implementation.
"""
slicecanvas
.
SliceCanvas
.
_zAxisChanged
(
self
,
*
a
)
self
.
_genSliceLocations
()
slicecanvas
.
SliceCanvas
.
_imageListChanged
(
self
,
*
a
)
def
_updateZAxisProperties
(
self
):
"""
Called by the :meth:`_imageBoundsChanged` method.
The purpose of this method is to set the slice spacing and displayed Z
range to something sensible when the Z axis, or Z image bounds are
changed (e.g. due to images being added/removed, or to image
transformation matrices being changed).
"""
newZRange
=
self
.
imageList
.
bounds
.
getRange
(
self
.
zax
)
newZGap
=
self
.
sliceSpacing
...
...
@@ -321,26 +333,14 @@ class LightBoxCanvas(slicecanvas.SliceCanvas):
# happen. So we do a check and, if the dimension ranges are the same,
# manually call _slicePropsChanged. Bringing out the ugly side of
# event driven programming.
if
self
.
zrange
.
x
==
newZRange
and
self
.
sliceSpacing
==
newZGap
:
self
.
_slicePropsChanged
()
else
:
self
.
zrange
.
x
=
newZRange
self
.
sliceSpacing
=
newZGap
self
.
setConstraint
(
'
zrange
'
,
'
minDistance
'
,
newZGap
)
def
_imageListChanged
(
self
,
*
a
):
"""
Overrides
:meth:`~fsl.fslview.gl.slicecanvas.SliceCanvas._imageListChanged`.
Regenerates slice locations for all images, and calls the super
implementation.
"""
self
.
_genSliceLocations
()
slicecanvas
.
SliceCanvas
.
_imageListChanged
(
self
,
*
a
)
def
_imageBoundsChanged
(
self
,
*
a
):
"""
Overrides
:meth:`fsl.fslview.gl.slicecanvas.SliceCanvas._imageBoundsChanged`.
...
...
@@ -366,6 +366,7 @@ class LightBoxCanvas(slicecanvas.SliceCanvas):
zgap
=
min
([
i
.
pixdim
[
self
.
zax
]
for
i
in
self
.
imageList
])
self
.
setConstraint
(
'
zrange
'
,
'
minDistance
'
,
zgap
)
self
.
_updateZAxisProperties
()
self
.
_calcNumSlices
()
self
.
_genSliceLocations
()
...
...
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