Commit e2fa21fc authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Renamed voxelsToScaledVoxels to voxToScaledVoxMat, and made it a

property. Also added scaledVoxToVoxMat
parent 307de777
......@@ -460,7 +460,7 @@ class Nifti(notifier.Notifier):
details='Use ndims instead')
def is4DImage(self):
"""Returns ``True`` if this image is 4D, ``False`` otherwise. """
......@@ -554,7 +554,16 @@ class Nifti(notifier.Notifier):
details='Use voxToScaledVoxMat instead')
def voxelsToScaledVoxels(self):
"""See :meth:`voxToScaledVoxMat`."""
return self.voxToScaledVoxMat
def voxToScaledVoxMat(self):
"""Returns a transformation matrix which transforms from voxel
coordinates into scaled voxel coordinates, with a left-right flip
if the image appears to be stored in neurological order.
......@@ -563,6 +572,12 @@ class Nifti(notifier.Notifier):
return self.__voxToScaledVoxMat()
def __voxToScaledVoxMat(self):
"""See :meth:`voxToScaledVoxMat`. """
shape = list(self.shape[ :3])
pixdim = list(self.pixdim[:3])
......@@ -576,6 +591,20 @@ class Nifti(notifier.Notifier):
return voxToPixdimMat
def scaledVoxToVoxMat(self):
"""Returns a transformation matrix which transforms from scaled voxels
into voxels, the inverse of the :meth:`voxToScaledVoxMat` transform.
return self.__scaledVoxToVoxMat()
def __scaledVoxToVoxMat(self):
"""See :meth:`scaledVoxToVoxMat`. """
return transform.invert(self.voxToScaledVoxMat)
def sameSpace(self, other):
"""Returns ``True`` if the ``other`` image (assumed to be a
:class:`Nifti` instance) has the same dimensions and is in the
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment