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
fslpy
Commits
dc5eadb2
Commit
dc5eadb2
authored
Sep 21, 2020
by
Paul McCarthy
🚵
Browse files
BF: Adjust fieldToRefMat in case the provided reference image has
different dimensions than the original reference image
parent
be82aa76
Changes
1
Hide whitespace changes
Inline
Side-by-side
fsl/transform/fnirt.py
View file @
dc5eadb2
...
...
@@ -225,6 +225,27 @@ def _readFnirtCoefficientField(fname, img, src, ref):
# image voxel coordinates.
fieldToRefMat
=
affine
.
scaleOffsetXform
(
knotSpacing
,
0
)
# But if the provided reference has
# different resolution to the
# reference that was originally
# used to generate the warp field,
# we need to adjust the field
# accordingly. We assume that the
# references are aligned in the FSL
# coordinate system, so simply apply
# a scaling factor calculated by
# dividing the original reference
# pixdims by the provided reference
# pixdims.
refPixdims
=
np
.
array
([
img
.
header
[
'intent_p1'
],
img
.
header
[
'intent_p2'
],
img
.
header
[
'intent_p3'
]])
if
not
np
.
all
(
np
.
isclose
(
ref
.
pixdim
[:
3
],
refPixdims
)):
fieldToRefMat
=
affine
.
concat
(
affine
.
scaleOffsetXform
(
refPixdims
/
ref
.
pixdim
[:
3
],
0
),
fieldToRefMat
)
return
nonlinear
.
CoefficientField
(
fname
,
src
,
ref
,
...
...
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