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
588f2bf8
Commit
588f2bf8
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
RF: applyDeformation supports input image with different FOV to original
source image
parent
b41c630c
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/transform/nonlinear.py
+17
-0
17 additions, 0 deletions
fsl/transform/nonlinear.py
with
17 additions
and
0 deletions
fsl/transform/nonlinear.py
+
17
−
0
View file @
588f2bf8
...
...
@@ -745,6 +745,8 @@ def applyDeformation(image, field, ref=None, order=1, mode=None, cval=None):
# truncation at the field boundaries,
# but there's nothing we can do about
# that.
src
=
field
.
src
if
not
field
.
sameSpace
(
ref
):
field
=
resample
.
resampleToReference
(
field
,
ref
,
...
...
@@ -755,6 +757,21 @@ def applyDeformation(image, field, ref=None, order=1, mode=None, cval=None):
else
:
field
=
field
.
data
# If the input image is in a
# different space to the field
# source space, we need to
# adjust the resampling matrix.
# We assume world-world alignment
# between the original source
# and the image to be resampled
if
not
image
.
sameSpace
(
src
):
post
=
affine
.
concat
(
image
.
getAffine
(
'
world
'
,
'
voxel
'
),
src
.
getAffine
(
'
voxel
'
,
'
world
'
))
shape
=
field
.
shape
field
=
field
.
reshape
((
-
1
,
3
))
field
=
affine
.
transform
(
field
,
post
)
field
=
field
.
reshape
(
shape
)
field
=
field
.
transpose
((
3
,
0
,
1
,
2
))
return
ndinterp
.
map_coordinates
(
image
.
data
,
field
,
...
...
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