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
5aa2612e
Commit
5aa2612e
authored
Jan 27, 2020
by
Paul McCarthy
🚵
Browse files
BF: resample should resample if shapes are different
parent
3647f196
Changes
1
Hide whitespace changes
Inline
Side-by-side
fsl/utils/image/resample.py
View file @
5aa2612e
...
...
@@ -47,9 +47,9 @@ def resampleToReference(image, reference, matrix=None, **kwargs):
along the spatial (first three) dimensions.
:arg image: :class:`.Image` to resample
:arg matrix: Optional world-to-world affine alignment matrix
:arg reference: :class:`.Nifti` defining the space to resample ``image``
into
:arg matrix: Optional world-to-world affine alignment matrix
"""
oldShape
=
list
(
image
.
shape
)
...
...
@@ -204,9 +204,10 @@ def resample(image,
if
matrix
is
None
:
matrix
=
affine
.
rescale
(
data
.
shape
,
newShape
,
origin
)
# identity matrix? the image
# doesn't need to be resampled
if
np
.
all
(
np
.
isclose
(
matrix
,
np
.
eye
(
len
(
newShape
)
+
1
))):
# same shape and identity matrix? the
# image doesn't need to be resampled
if
np
.
all
(
np
.
isclose
(
image
.
shape
,
newShape
))
and
\
np
.
all
(
np
.
isclose
(
matrix
,
np
.
eye
(
len
(
newShape
)
+
1
))):
return
data
,
image
.
voxToWorldMat
newShape
=
np
.
array
(
np
.
round
(
newShape
),
dtype
=
np
.
int
)
...
...
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