Commit 3fc46784 authored by Taylor Hanayik's avatar Taylor Hanayik
Browse files

add bet center coords

parent 1d90a344
...@@ -62,12 +62,23 @@ class BetGui(BaseGui): ...@@ -62,12 +62,23 @@ class BetGui(BaseGui):
self.view.options.cb_save_mask.Bind(wx.EVT_CHECKBOX, self._on_save_mask) self.view.options.cb_save_mask.Bind(wx.EVT_CHECKBOX, self._on_save_mask)
self.view.options.cb_save_overlay.Bind(wx.EVT_CHECKBOX, self._on_save_overlay) self.view.options.cb_save_overlay.Bind(wx.EVT_CHECKBOX, self._on_save_overlay)
self.view.options.cb_save_skull.Bind(wx.EVT_CHECKBOX, self._on_save_skull) self.view.options.cb_save_skull.Bind(wx.EVT_CHECKBOX, self._on_save_skull)
self.view.options.coordx.Bind(wx.EVT_SPINCTRLDOUBLE, self._on_coord_update)
self.view.options.coordy.Bind(wx.EVT_SPINCTRLDOUBLE, self._on_coord_update)
self.view.options.coordz.Bind(wx.EVT_SPINCTRLDOUBLE, self._on_coord_update)
self.view.action_panel.play_icon.Bind(wx.EVT_LEFT_UP, self._on_run) self.view.action_panel.play_icon.Bind(wx.EVT_LEFT_UP, self._on_run)
self.view.action_panel.code_icon.Bind(wx.EVT_LEFT_UP, self._on_code) self.view.action_panel.code_icon.Bind(wx.EVT_LEFT_UP, self._on_code)
self.view.input.file_ctrl.Bind(wx.EVT_TEXT, self._on_input_edit) self.view.input.file_ctrl.Bind(wx.EVT_TEXT, self._on_input_edit)
self.view.output.file_ctrl.Bind(wx.EVT_TEXT, self._on_output_edit) self.view.output.file_ctrl.Bind(wx.EVT_TEXT, self._on_output_edit)
self.view.t2_input.file_ctrl.Bind(wx.EVT_TEXT, self._on_t2_input_edit) self.view.t2_input.file_ctrl.Bind(wx.EVT_TEXT, self._on_t2_input_edit)
def _on_coord_update(self, event):
x = self.view.options.coordx.GetValue()
y = self.view.options.coordy.GetValue()
z = self.view.options.coordz.GetValue()
self.model.center_coord = (x, y, z)
print(self.model.center_coord)
def _on_input_edit(self, event): def _on_input_edit(self, event):
widget = event.GetEventObject() widget = event.GetEventObject()
val = widget.GetValue() val = widget.GetValue()
......
...@@ -36,6 +36,7 @@ class Bet: ...@@ -36,6 +36,7 @@ class Bet:
bet_type="", bet_type="",
fval=0.5, fval=0.5,
gval=0, gval=0,
center_coord=(),
discard_bet=False, discard_bet=False,
save_mask=False, save_mask=False,
applythresh=False, applythresh=False,
...@@ -51,6 +52,7 @@ class Bet: ...@@ -51,6 +52,7 @@ class Bet:
self._bet_type = bet_type self._bet_type = bet_type
self._fval = fval self._fval = fval
self._gval = gval self._gval = gval
self._center_coord = center_coord
self._discard_bet = discard_bet self._discard_bet = discard_bet
self._save_mask = save_mask self._save_mask = save_mask
self._applythresh = applythresh self._applythresh = applythresh
...@@ -127,6 +129,15 @@ class Bet: ...@@ -127,6 +129,15 @@ class Bet:
assert (val >= -1) & (val <= 1), "gval must be in the range -1 .. 1" assert (val >= -1) & (val <= 1), "gval must be in the range -1 .. 1"
self._gval = val self._gval = val
@property
def center_coord(self):
return self._center_coord
@center_coord.setter
def center_coord(self, coord):
assert (isinstance(coord, tuple)) & (len(coord) == 3)
self._center_coord = coord
@property @property
def discard_bet(self): def discard_bet(self):
return self._discard_bet return self._discard_bet
...@@ -225,6 +236,9 @@ class Bet: ...@@ -225,6 +236,9 @@ class Bet:
def command(self): def command(self):
"""
make command line string to call program
"""
FSLDIR = os.getenv("FSLDIR", None) FSLDIR = os.getenv("FSLDIR", None)
if FSLDIR is None: if FSLDIR is None:
return False return False
...@@ -232,6 +246,7 @@ class Bet: ...@@ -232,6 +246,7 @@ class Bet:
return False return False
if (len(self.image_t2) > 0) & (os.path.isfile(self.image_t2) is False): if (len(self.image_t2) > 0) & (os.path.isfile(self.image_t2) is False):
return False return False
cmd = [ cmd = [
os.path.join(FSLDIR, 'bin', 'bet'), os.path.join(FSLDIR, 'bin', 'bet'),
self.image_in, self.image_in,
...@@ -239,6 +254,11 @@ class Bet: ...@@ -239,6 +254,11 @@ class Bet:
'-f', str(self.fval), '-f', str(self.fval),
'-g', str(self.gval) '-g', str(self.gval)
] ]
if self._center_coord != (0, 0, 0):
(x, y, z) = self._center_coord
cmd.extend(['-c', str(x), str(y), str(z)])
for key in self._bool_argmap: for key in self._bool_argmap:
if self._bool_argmap[key]: if self._bool_argmap[key]:
cmd.append(key) cmd.append(key)
......
...@@ -13,6 +13,9 @@ import fsl.gui.widgets as fslwidgets ...@@ -13,6 +13,9 @@ import fsl.gui.widgets as fslwidgets
class BetOptions(wx.CollapsiblePane): class BetOptions(wx.CollapsiblePane):
""" """
BetOptions is a collapsible pane containing widgets that control
bet's operation.
add the Options pane to a parent's sizer with a proportion value of 0. add the Options pane to a parent's sizer with a proportion value of 0.
""" """
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
...@@ -58,6 +61,25 @@ class BetOptions(wx.CollapsiblePane): ...@@ -58,6 +61,25 @@ class BetOptions(wx.CollapsiblePane):
self.gval_panel.sizer.Add(self.gval_control, 0, wx.ALL, 5) self.gval_panel.sizer.Add(self.gval_control, 0, wx.ALL, 5)
self.gval_panel.SetSizer(self.gval_panel.sizer) self.gval_panel.SetSizer(self.gval_panel.sizer)
# the bet center coordinates
self.coord_panel = wx.Panel(pane)
self.coord_panel.sizer = wx.BoxSizer(wx.HORIZONTAL)
self.coordx = wx.SpinCtrlDouble(self.coord_panel, min=0, max=10000, initial=0, inc=1)
self.coordy = wx.SpinCtrlDouble(self.coord_panel, min=0, max=10000, initial=0, inc=1)
self.coordz = wx.SpinCtrlDouble(self.coord_panel, min=0, max=10000, initial=0, inc=1)
self.label_coordstr = wx.StaticText(self.coord_panel, label="Center point: ")
self.labelx = wx.StaticText(self.coord_panel, label="X ")
self.labely = wx.StaticText(self.coord_panel, label="Y ")
self.labelz = wx.StaticText(self.coord_panel, label="Z ")
self.coord_panel.sizer.Add(self.label_coordstr, 0, wx.ALL, 5)
self.coord_panel.sizer.Add(self.labelx, 0, wx.ALL, 5)
self.coord_panel.sizer.Add(self.coordx, 0, wx.ALL, 5)
self.coord_panel.sizer.Add(self.labely, 0, wx.ALL, 5)
self.coord_panel.sizer.Add(self.coordy, 0, wx.ALL, 5)
self.coord_panel.sizer.Add(self.labelz, 0, wx.ALL, 5)
self.coord_panel.sizer.Add(self.coordz, 0, wx.ALL, 5)
self.coord_panel.SetSizer(self.coord_panel.sizer)
# now add all of the options widgets to the sizer # now add all of the options widgets to the sizer
sizer.Add(self.fval_panel, 0, wx.ALL, 0) # 0 pixel border since the fval_panel already applied a 5 pix border sizer.Add(self.fval_panel, 0, wx.ALL, 0) # 0 pixel border since the fval_panel already applied a 5 pix border
sizer.Add(self.bet_choice_panel, 0, wx.ALL, 0) sizer.Add(self.bet_choice_panel, 0, wx.ALL, 0)
...@@ -67,13 +89,17 @@ class BetOptions(wx.CollapsiblePane): ...@@ -67,13 +89,17 @@ class BetOptions(wx.CollapsiblePane):
sizer.Add(self.cb_save_skull, 0, wx.ALL, 5) sizer.Add(self.cb_save_skull, 0, wx.ALL, 5)
sizer.Add(self.cb_save_overlay, 0, wx.ALL, 5) sizer.Add(self.cb_save_overlay, 0, wx.ALL, 5)
sizer.Add(self.cb_verbose, 0, wx.ALL, 5) sizer.Add(self.cb_verbose, 0, wx.ALL, 5)
sizer.Add(self.gval_panel, 0,wx.ALL, 0) sizer.Add(self.gval_panel, 0, wx.ALL, 0)
sizer.Add(self.coord_panel, 0, wx.ALL, 0)
# now layout the widgets so they can be sized appropriately (automatically done by wx) # now layout the widgets so they can be sized appropriately (automatically done by wx)
pane.SetSizer(sizer) pane.SetSizer(sizer)
class BetView(wx.Panel): class BetView(wx.Panel):
"""
Bet view defines the graphical layout of widgets for using BET
"""
def __init__(self, parent, title="BET", **kwargs): def __init__(self, parent, title="BET", **kwargs):
super().__init__(parent, **kwargs) super().__init__(parent, **kwargs)
self.parent = parent self.parent = parent
...@@ -113,5 +139,15 @@ class BetView(wx.Panel): ...@@ -113,5 +139,15 @@ class BetView(wx.Panel):
self.SetSizer(sizer) self.SetSizer(sizer)
class FslStartup(): class FlirtView():
pass """
\ No newline at end of file FlirtView defines the graphical layout of widgets used in Flirt
"""
class FslView():
"""
FslView is the main FSL start window.
"""
"""
the widges module provides common widgets that are intended
to be embedded within other FSL guis.
"""
import os import os
import wx import wx
import fsleyes.overlay as fsloverlay import fsleyes.overlay as fsloverlay
import fsleyes.displaycontext as fsldc import fsleyes.displaycontext as fsldc
import fsleyes.views.orthopanel as orthopanel import fsleyes.views.orthopanel as orthopanel
import fsl.data.image as fslimage
from fsleyes.main import embed from fsleyes.main import embed
import fsleyes.profiles as profiles import fsleyes.profiles as profiles
import fsleyes.profiles.profilemap as profilemap import fsleyes.profiles.profilemap as profilemap
from fsleyes.frame import FSLeyesFrame from fsleyes.frame import FSLeyesFrame
import fsl.data.image as fslimage
import fsl.gui.icons as fslicons import fsl.gui.icons as fslicons
def layout_from(widget): def layout_from(widget):
......
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