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

Is that it, apart from location panel? Transformation matrix decoupling

nearly done. But completely untested, documentatino out of date, and
probably broken.
parent c1d32485
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@ import matplotlib.pyplot as plt
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas
import fsl.fslview.viewpanel as viewpanel
import fsl.utils.transform as transform
class TimeSeriesPanel(viewpanel.ViewPanel):
......@@ -125,7 +126,10 @@ class TimeSeriesPanel(viewpanel.ViewPanel):
for image in self._imageList:
ix, iy, iz = image.worldToVox([[x, y, z]])[0]
display = image.getAttribute('display')
xform = display.displayToVoxMat
ix, iy, iz = transform.transform([[x, y, z]], xform)[0]
ix = round(ix)
iy = round(iy)
......
......@@ -11,6 +11,7 @@ import props
import fsl.data.imagefile as imagefile
import fsl.data.image as fslimage
import fsl.utils.transform as transform
import fsl.fslview.displaycontext as displaycontext
runChoices = OrderedDict((
......@@ -189,6 +190,7 @@ def selectHeadCentre(opts, button):
image = fslimage.Image(opts.inputImage)
imageList = fslimage.ImageList([image])
displayCtx = displaycontext.DisplayContext(imageList)
display = image.getAttribute('display')
parent = button.GetTopLevelParent()
frame = orthopanel.OrthoDialog(parent,
imageList,
......@@ -196,11 +198,13 @@ def selectHeadCentre(opts, button):
opts.inputImage,
style=wx.RESIZE_BORDER)
panel = frame.panel
v2dMat = display.voxToDisplayMat
d2vMat = display.displayToVoxMat
# Whenever the x/y/z coordinates change on
# the ortho panel, update the option values.
def updateOpts(*a):
x, y, z = image.worldToVox([displayCtx.location])[0]
x, y, z = transform.transform([displayCtx.location], d2vMat)[0]
if x >= image.shape[0]: x = image.shape[0] - 1
elif x < 0: x = 0
......@@ -222,7 +226,7 @@ def selectHeadCentre(opts, button):
# done after the frame has been displayed, i.e
# via wx.CallAfter or similar.
voxCoords = [opts.xCoordinate, opts.yCoordinate, opts.zCoordinate]
worldCoords = image.voxToWorld([voxCoords])[0]
worldCoords = transform.transform([voxCoords], v2dMat)[0]
panel.pos = worldCoords
# Position the dialog by the button that was clicked
......
......@@ -18,6 +18,7 @@ import argparse
import props
import fsl.data.image as fslimage
import fsl.utils.transform as transform
import fsl.fslview.displaycontext as displaycontext
......@@ -252,7 +253,9 @@ def handleImageArgs(args):
if args.worldloc:
loc = args.worldloc
elif args.voxelloc:
loc = imageList[0].voxToWorld([args.voxelloc])[0]
display = imageList[0].getAttribute('display')
xform = display.voxToDisplayMat
loc = transform.transform([[args.voxelloc]], xform)[0]
else:
loc = [displayCtx.bounds.xlo + 0.5 * displayCtx.bounds.xlen,
......
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