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

BF: only add in-bounds coordinates

parent eccddc1c
No related branches found
No related tags found
No related merge requests found
...@@ -215,7 +215,7 @@ class DisplacementField(NonLinearTransform): ...@@ -215,7 +215,7 @@ class DisplacementField(NonLinearTransform):
xs, ys, zs = voxels.T xs, ys, zs = voxels.T
if self.absolute: disps = self.data[xs, ys, zs, :] if self.absolute: disps = self.data[xs, ys, zs, :]
else: disps = self.data[xs, ys, zs, :] + coords else: disps = self.data[xs, ys, zs, :] + coords[voxmask]
# Make sure the coordinates # Make sure the coordinates
# are in the requested # are in the requested
...@@ -302,8 +302,8 @@ def convertDisplacementSpace(field, from_, to): ...@@ -302,8 +302,8 @@ def convertDisplacementSpace(field, from_, to):
:arg from_: New source image coordinate system :arg from_: New source image coordinate system
:arg to: New reference image coordinate system :arg to: New reference image coordinate system
:returns: A new :class:`DisplacementField` which transforms from :returns: A new :class:`DisplacementField` which transforms between
the source ``from_`` coordinate system to the reference ``to`` the source ``from_`` coordinate system and the reference ``to``
coordinate system. coordinate system.
""" """
...@@ -330,12 +330,12 @@ def convertDisplacementSpace(field, from_, to): ...@@ -330,12 +330,12 @@ def convertDisplacementSpace(field, from_, to):
# Otherwise our displacement field # Otherwise our displacement field
# will contain relative displacements # will contain relative displacements
# betwee the reference image "to" # between the reference image "to"
# coordinate system and the source # coordinate system and the source
# image "from_" coordinate system. # image "from_" coordinate system.
# We need to re-calculate the relative # We need to re-calculate the relative
# displacements from source "from_" # displacements between source "from_"
# space into reference "to" space. # space and reference "to" space.
else: else:
refmat = field.ref.getAffine(field.refSpace, to) refmat = field.ref.getAffine(field.refSpace, to)
refcoords = fieldcoords.reshape((-1, 3)) refcoords = fieldcoords.reshape((-1, 3))
......
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