diff --git a/fsl/transform/nonlinear.py b/fsl/transform/nonlinear.py index 0625147003f1f95cea6fb5d3f70118f10c178fc2..ab1a9641fd0adb11057f4fd553134d27fb2d8db8 100644 --- a/fsl/transform/nonlinear.py +++ b/fsl/transform/nonlinear.py @@ -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, diff --git a/fsl/utils/image/resample.py b/fsl/utils/image/resample.py index 1aa52b9d2a96a4318a5c66c9e51bd4ca2a062b11..50dc0c4022cc5b32f763d8afd43f3d7fb31fba47 100644 --- a/fsl/utils/image/resample.py +++ b/fsl/utils/image/resample.py @@ -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)