Skip to content
Snippets Groups Projects
Commit 15ddfed9 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

BF: Can't short-cut convertDeformationType, as it causes inf recursion between

DefField.deformationType and detectDeformationType. Also fix applyDeformation
where not using altref
parent 5d1153f5
No related branches found
No related tags found
No related merge requests found
......@@ -582,9 +582,6 @@ def convertDeformationType(field, defType=None):
if field.deformationType == 'absolute': defType = 'relative'
else: defType = 'absolute'
if field.deformationType == defType:
return field.data
# Regardless of the conversion direction,
# we need the coordinates of every voxel
# in the reference coordinate system.
......@@ -743,6 +740,9 @@ def applyDeformation(image, field, ref=None, order=1, mode=None, cval=None):
mode='constant',
cval=-1)[0]
else:
field = field.data
field = field.transpose((3, 0, 1, 2))
return ndinterp.map_coordinates(image.data,
field,
......
......@@ -67,7 +67,9 @@ def resampleToReference(image, reference, matrix=None, **kwargs):
newShape = newShape + oldShape[len(newShape):]
# Align the two images together
# via their vox-to-world affines.
# via their vox-to-world affines,
# and the world-to-world affine
# if provided
matrix = affine.concat(image.worldToVoxMat,
affine.invert(matrix),
reference.voxToWorldMat)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment