Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
fsleyes
fsleyes
Commits
1a5a2f01
Commit
1a5a2f01
authored
Oct 01, 2021
by
Paul McCarthy
🚵
Browse files
BF: Use 'pixdim' affine for scaled voxel display space, not 'pixdim-flip', as
the latter will potentially L/R flip some images
parent
4aa0432b
Changes
2
Hide whitespace changes
Inline
Side-by-side
fsleyes/displaycontext/displaycontext.py
View file @
1a5a2f01
...
@@ -185,7 +185,7 @@ class DisplayContext(props.SyncableHasProperties):
...
@@ -185,7 +185,7 @@ class DisplayContext(props.SyncableHasProperties):
system, with origin set to the centre of voxel ``(0, 0, 0)``, and
system, with origin set to the centre of voxel ``(0, 0, 0)``, and
voxels scaled by image pixdims. This is accomplished by setting the
voxels scaled by image pixdims. This is accomplished by setting the
:attr:`.NiftiOpts.transform` property for every ``Nifti`` overlay to
:attr:`.NiftiOpts.transform` property for every ``Nifti`` overlay to
``pixdim
-flip
``.
``pixdim``.
3. **Reference image** space
3. **Reference image** space
...
@@ -533,7 +533,10 @@ class DisplayContext(props.SyncableHasProperties):
...
@@ -533,7 +533,10 @@ class DisplayContext(props.SyncableHasProperties):
# (reference image), we decide based on the ref
# (reference image), we decide based on the ref
# image.
# image.
elif
space
==
'scaledVoxel'
:
elif
space
==
'scaledVoxel'
:
space
=
self
.
getSelectedOverlay
()
space
=
self
.
getSelectedOverlay
()
srcSpace
=
'pixdim'
else
:
srcSpace
=
'pixdim-flip'
# Use the FSL / FLIRT convention - if the affine
# Use the FSL / FLIRT convention - if the affine
# determinant is negative, assume neurological
# determinant is negative, assume neurological
...
@@ -542,7 +545,7 @@ class DisplayContext(props.SyncableHasProperties):
...
@@ -542,7 +545,7 @@ class DisplayContext(props.SyncableHasProperties):
ref
=
self
.
getOpts
(
space
).
referenceImage
ref
=
self
.
getOpts
(
space
).
referenceImage
if
ref
is
not
None
:
if
ref
is
not
None
:
opts
=
self
.
getOpts
(
space
)
opts
=
self
.
getOpts
(
space
)
xform
=
opts
.
getTransform
(
'pixdim-flip'
,
'display'
)
xform
=
opts
.
getTransform
(
srcSpace
,
'display'
)
return
npla
.
det
(
xform
)
>
0
return
npla
.
det
(
xform
)
>
0
# no nifti overlays loaded
# no nifti overlays loaded
...
@@ -901,7 +904,7 @@ class DisplayContext(props.SyncableHasProperties):
...
@@ -901,7 +904,7 @@ class DisplayContext(props.SyncableHasProperties):
# listener on the bounds property.
# listener on the bounds property.
with
props
.
skip
(
opts
,
'bounds'
,
self
.
__name
,
ignoreInvalid
=
True
):
with
props
.
skip
(
opts
,
'bounds'
,
self
.
__name
,
ignoreInvalid
=
True
):
if
space
==
'world'
:
opts
.
transform
=
'affine'
if
space
==
'world'
:
opts
.
transform
=
'affine'
elif
space
==
'scaledVoxel'
:
opts
.
transform
=
'pixdim
-flip
'
elif
space
==
'scaledVoxel'
:
opts
.
transform
=
'pixdim'
elif
image
is
space
:
opts
.
transform
=
'pixdim-flip'
elif
image
is
space
:
opts
.
transform
=
'pixdim-flip'
else
:
opts
.
transform
=
'reference'
else
:
opts
.
transform
=
'reference'
...
@@ -1168,7 +1171,7 @@ class DisplayContext(props.SyncableHasProperties):
...
@@ -1168,7 +1171,7 @@ class DisplayContext(props.SyncableHasProperties):
if
self
.
displaySpace
==
'scaledVoxel'
:
if
self
.
displaySpace
==
'scaledVoxel'
:
ref
=
self
.
getSelectedOverlay
()
ref
=
self
.
getSelectedOverlay
()
srcSpace
=
'pixdim
-flip
'
srcSpace
=
'pixdim'
else
:
else
:
ref
=
self
.
displaySpace
ref
=
self
.
displaySpace
srcSpace
=
'display'
srcSpace
=
'display'
...
...
fsleyes/displaycontext/niftiopts.py
View file @
1a5a2f01
...
@@ -36,7 +36,8 @@ in one of several ways:
...
@@ -36,7 +36,8 @@ in one of several ways:
image appears to be stored in neurological
image appears to be stored in neurological
order, the X (left-right) axis is
order, the X (left-right) axis is
inverted. The origin is fixed at the centre of
inverted. The origin is fixed at the centre of
voxel ``(0, 0, 0)``.
voxel ``(0, 0, 0)`` (or ``(X-1, 0, 0)`` for
inverted images).
**world** (a.k.a. ``affine``) The image data voxel
**world** (a.k.a. ``affine``) The image data voxel
coordinates are transformed by the
coordinates are transformed by the
...
@@ -445,7 +446,7 @@ class NiftiOpts(fsldisplay.DisplayOpts):
...
@@ -445,7 +446,7 @@ class NiftiOpts(fsldisplay.DisplayOpts):
if
ds
==
'world'
:
if
ds
==
'world'
:
voxToRefMat
=
voxToWorldMat
voxToRefMat
=
voxToWorldMat
elif
ds
==
'scaledVoxel'
:
elif
ds
==
'scaledVoxel'
:
voxToRefMat
=
voxToPix
Flip
Mat
voxToRefMat
=
voxToPix
dim
Mat
elif
ds
is
self
.
overlay
:
elif
ds
is
self
.
overlay
:
voxToRefMat
=
voxToPixFlipMat
voxToRefMat
=
voxToPixFlipMat
else
:
else
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment