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

RF: Cosmetic linting

parent dc5eadb2
No related branches found
No related tags found
No related merge requests found
...@@ -496,13 +496,11 @@ class CoefficientField(NonLinearTransform): ...@@ -496,13 +496,11 @@ class CoefficientField(NonLinearTransform):
fdata = self.data fdata = self.data
nx, ny, nz = self.shape[:3] nx, ny, nz = self.shape[:3]
ix, iy, iz = self.ref.shape[:3]
# Convert the given voxel coordinates # Convert the given voxel coordinates
# into the corresponding coefficient # into the corresponding coefficient
# field voxel coordinates # field voxel coordinates
x, y, z = coords.T i, j, k = affine.transform(coords, self.refToFieldMat).T
i, j, k = affine.transform(coords, self.refToFieldMat).T
# i, j, k: coefficient field indices # i, j, k: coefficient field indices
# u, v, w: position of the ref voxel # u, v, w: position of the ref voxel
...@@ -582,6 +580,10 @@ def convertDeformationType(field, defType=None): ...@@ -582,6 +580,10 @@ def convertDeformationType(field, defType=None):
if field.deformationType == 'absolute': defType = 'relative' if field.deformationType == 'absolute': defType = 'relative'
else: defType = 'absolute' else: defType = 'absolute'
if defType not in ('absolute', 'relative'):
raise ValueError('defType must be "absolute" or "relative" '
'("{}" passed)'.format(defType))
# Regardless of the conversion direction, # Regardless of the conversion direction,
# we need the coordinates of every voxel # we need the coordinates of every voxel
# in the reference coordinate system. # in the reference coordinate system.
...@@ -601,8 +603,8 @@ def convertDeformationType(field, defType=None): ...@@ -601,8 +603,8 @@ def convertDeformationType(field, defType=None):
# assumed to be) the relative shift. Or, # assumed to be) the relative shift. Or,
# to convert from absolute to relative, # to convert from absolute to relative,
# we subtract the reference image voxels. # we subtract the reference image voxels.
if defType == 'absolute': return field.data + coords if defType == 'absolute': return field.data + coords
elif defType == 'relative': return field.data - coords else: return field.data - coords
def convertDeformationSpace(field, from_, to): def convertDeformationSpace(field, from_, to):
......
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