diff --git a/fsl.py b/fsl.py index 7b7f3a5e2c563b90bd1b6af1a24ac4aa760d25de..b0854b773a75931f4283a30c29358f16b6bebaa9 100755 --- a/fsl.py +++ b/fsl.py @@ -151,15 +151,15 @@ def buildGUI(fslTool, toolCtx, fslEnvActive): actions.append(( wx.ID_HELP, '{} Help'.format(fslTool.toolName), - lambda ev: webpage.openFSLHelp(fslTool.helpPage))) + lambda *ev: webpage.openFSLHelp(fslTool.helpPage))) for (name, func) in fslTool.actions: - actions.append((-1, name, lambda ev: func(frame, ctx))) + actions.append((wx.ID_ANY, name, lambda ev, f=func: f(frame, ctx))) actions.append(( wx.ID_EXIT, 'Exit', - lambda ev: frame.Close())) + lambda *ev: frame.Close())) for wxId, name, func in actions: menuItem = fslMenu.Append(wxId, name) diff --git a/fsl/fslview/slicecanvas.py b/fsl/fslview/slicecanvas.py index 5071bbde76093f56c070841e1c165c4c148b3d6d..93e1ade7cfb31533f69f8f9c308f532ac9482b2a 100644 --- a/fsl/fslview/slicecanvas.py +++ b/fsl/fslview/slicecanvas.py @@ -461,6 +461,13 @@ class SliceCanvas(wxgl.GLCanvas): self._ypos = None self._zpos = None + self.xmin = 0 + self.ymin = 0 + self.zmin = 0 + self.xmax = 1 + self.ymax = 1 + self.zmax = 1 + # This flag is set by the _initGLData method # when it has finished initialising the OpenGL # shaders diff --git a/fsl/tools/bet.py b/fsl/tools/bet.py index 39dc18f89960d823f14b62693c6228c08a501cd2..4aa4c207669be1b1f2ecae46b0671fdd49c5f604 100644 --- a/fsl/tools/bet.py +++ b/fsl/tools/bet.py @@ -140,10 +140,13 @@ class Options(props.HasProperties): cmd.append('-r') cmd.append('{}'.format(self.headRadius)) - if all((self.xCoordinate > 0.0, + if any((self.xCoordinate > 0.0, self.yCoordinate > 0.0, self.zCoordinate > 0.0)): cmd.append('-c') + print type(self.xCoordinate) + print self.xCoordinate + print '{}'.format(self.xCoordinate) cmd.append('{}'.format(self.xCoordinate)) cmd.append('{}'.format(self.yCoordinate)) cmd.append('{}'.format(self.zCoordinate)) @@ -196,11 +199,6 @@ def selectHeadCentre(opts, button): frame = orthopanel.OrthoFrame(parent, imageList, opts.inputImage) panel = frame.panel - voxCoords = [opts.xCoordinate, opts.yCoordinate, opts.zCoordinate] - worldCoords = image.voxToWorld([voxCoords])[0] - - panel.setLocation(*worldCoords) - # Whenever the x/y/z coordinates change on # the Options object,update the orthopanel # location @@ -228,9 +226,9 @@ def selectHeadCentre(opts, button): # And whenever the x/y/z coordinates change # on the dialog, update the option values. def updateOpts(ev): - x = image.worldToVox(ev.x, axes=0) - y = image.worldToVox(ev.y, axes=1) - z = image.worldToVox(ev.z, axes=2) + x = int(image.worldToVox(ev.x, axes=0)) + y = int(image.worldToVox(ev.y, axes=1)) + z = int(image.worldToVox(ev.z, axes=2)) if x >= image.shape[0]: x = image.shape[0] - 1 elif x < 0: x = 0 @@ -252,6 +250,14 @@ def selectHeadCentre(opts, button): frame.SetPosition(pos) frame.Show() + # TODO this needs to be 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] + panel.setLocation(*worldCoords) + + + betView = props.NotebookGroup(( props.VGroup(