Skip to content
Snippets Groups Projects
Commit 252cd24c authored by Paul McCarthy's avatar Paul McCarthy
Browse files

Dangerous change - scaleOffsetXform and transform.transform were

returning/assuming transposed affines (column-major). This is because that's
what OpenGL uses.
parent bc1efa7e
No related branches found
No related tags found
No related merge requests found
...@@ -495,7 +495,7 @@ class AtlasDescription(object): ...@@ -495,7 +495,7 @@ class AtlasDescription(object):
# Load the appropriate transformation matrix # Load the appropriate transformation matrix
# and transform all those voxel coordinates # and transform all those voxel coordinates
# into world coordinates # into world coordinates
coords = transform.transform(coords, self.xforms[0].T) coords = transform.transform(coords, self.xforms[0])
# Update the coordinates # Update the coordinates
# in our label objects # in our label objects
...@@ -594,7 +594,7 @@ class LabelAtlas(Atlas): ...@@ -594,7 +594,7 @@ class LabelAtlas(Atlas):
location, or ``None`` if the location is out of bounds. location, or ``None`` if the location is out of bounds.
""" """
voxelLoc = transform.transform([worldLoc], self.worldToVoxMat.T)[0] voxelLoc = transform.transform([worldLoc], self.worldToVoxMat)[0]
voxelLoc = [int(v) for v in voxelLoc.round()] voxelLoc = [int(v) for v in voxelLoc.round()]
if voxelLoc[0] < 0 or \ if voxelLoc[0] < 0 or \
...@@ -642,7 +642,7 @@ class ProbabilisticAtlas(Atlas): ...@@ -642,7 +642,7 @@ class ProbabilisticAtlas(Atlas):
location. Returns an empty list if the given location. Returns an empty list if the given
location is out of bounds. location is out of bounds.
""" """
voxelLoc = transform.transform([worldLoc], self.worldToVoxMat.T)[0] voxelLoc = transform.transform([worldLoc], self.worldToVoxMat)[0]
voxelLoc = [int(v) for v in voxelLoc.round()] voxelLoc = [int(v) for v in voxelLoc.round()]
if voxelLoc[0] < 0 or \ if voxelLoc[0] < 0 or \
......
...@@ -355,7 +355,7 @@ def loadClusterResults(featdir, settings, contrast): ...@@ -355,7 +355,7 @@ def loadClusterResults(featdir, settings, contrast):
# later on. # later on.
coordXform = fslimage.Image( coordXform = fslimage.Image(
getDataFile(featdir), getDataFile(featdir),
loadData=False).worldToVoxMat.T loadData=False).worldToVoxMat
if not op.exists(clusterFile): if not op.exists(clusterFile):
return None return None
......
...@@ -73,9 +73,9 @@ def scaleOffsetXform(scales, offsets): ...@@ -73,9 +73,9 @@ def scaleOffsetXform(scales, offsets):
xform[1, 1] = scales[1] xform[1, 1] = scales[1]
xform[2, 2] = scales[2] xform[2, 2] = scales[2]
xform[3, 0] = offsets[0] xform[0, 3] = offsets[0]
xform[3, 1] = offsets[1] xform[1, 3] = offsets[1]
xform[3, 2] = offsets[2] xform[2, 3] = offsets[2]
return xform return xform
...@@ -337,8 +337,8 @@ def transform(p, xform, axes=None): ...@@ -337,8 +337,8 @@ def transform(p, xform, axes=None):
scalings. scalings.
""" """
p = _fillPoints(p, axes) p = _fillPoints(p, axes)
t = np.dot(xform[:3, :3].T, p.T).T + xform[3, :3] t = np.dot(xform[:3, :3], p.T).T + xform[:3, 3]
if axes is not None: if axes is not None:
t = t[:, axes] t = t[:, axes]
......
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