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

Bugfix in transform (numpy.linalg.dot does not exist - it's

numpy.dot). And a few tweaks elsewhere
parent ef5ea65e
No related branches found
No related tags found
No related merge requests found
...@@ -318,15 +318,15 @@ class ImageDisplay(props.HasProperties): ...@@ -318,15 +318,15 @@ class ImageDisplay(props.HasProperties):
pixdim = self.image.pixdim pixdim = self.image.pixdim
voxToDisplayMat = np.diag([pixdim[0], pixdim[1], pixdim[2], 1.0]) voxToDisplayMat = np.diag([pixdim[0], pixdim[1], pixdim[2], 1.0])
elif self.transform == 'affine': elif self.transform == 'affine':
voxToDisplayMat = self.image.voxToWorldMat voxToDisplayMat = self.voxToWorldMat
voxToDisplayMat = np.array(voxToDisplayMat, dtype=np.float32) voxToDisplayMat = np.array(voxToDisplayMat, dtype=np.float32)
displayToVoxMat = transform.invert(voxToDisplayMat) displayToVoxMat = transform.invert(voxToDisplayMat)
# Transformation matrices for moving between the voxel # Transformation matrices for moving between the voxel
# coordinate system and the display coordinate system # coordinate system and the display coordinate system
self.voxToDisplayMat = voxToDisplayMat.transpose() self.voxToDisplayMat = voxToDisplayMat
self.displayToVoxMat = displayToVoxMat.transpose() self.displayToVoxMat = displayToVoxMat
# Matrices for moving between the display coordinate # Matrices for moving between the display coordinate
# system, and the image world coordinate system # system, and the image world coordinate system
......
...@@ -290,10 +290,6 @@ class OrthoPanel(canvaspanel.CanvasPanel): ...@@ -290,10 +290,6 @@ class OrthoPanel(canvaspanel.CanvasPanel):
for changes on its affine transformation matrix. for changes on its affine transformation matrix.
""" """
self._refreshLabels()
if len(self._imageList) == 0: return
for i, img in enumerate(self._imageList): for i, img in enumerate(self._imageList):
display = img.getAttribute('display') display = img.getAttribute('display')
...@@ -307,6 +303,12 @@ class OrthoPanel(canvaspanel.CanvasPanel): ...@@ -307,6 +303,12 @@ class OrthoPanel(canvaspanel.CanvasPanel):
self._name, self._name,
self._refreshLabels) self._refreshLabels)
# _refreshLabels will in turn call
# _layoutChanged, which is needed
# in case the display bounds have
# changed
self._refreshLabels()
def _onDestroy(self, ev): def _onDestroy(self, ev):
"""Called when this panel is destroyed. """Called when this panel is destroyed.
...@@ -585,6 +587,9 @@ class OrthoPanel(canvaspanel.CanvasPanel): ...@@ -585,6 +587,9 @@ class OrthoPanel(canvaspanel.CanvasPanel):
self._zCanvasPanel.Show(self.showZCanvas) self._zCanvasPanel.Show(self.showZCanvas)
if len(canvases) == 0: if len(canvases) == 0:
self.Layout()
self.getCanvasPanel().Layout()
self.Refresh()
return return
# Regardless of the layout, we use a # Regardless of the layout, we use a
......
...@@ -20,7 +20,7 @@ def invert(x): ...@@ -20,7 +20,7 @@ def invert(x):
def concat(x1, x2): def concat(x1, x2):
"""Combines the two matrices (returns the dot product).""" """Combines the two matrices (returns the dot product)."""
return linalg.dot(x1, x2) return np.dot(x1, x2)
def axisBounds(shape, xform, axis): def axisBounds(shape, xform, axis):
......
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