Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
fslgui
Commits
3fc46784
Commit
3fc46784
authored
Mar 17, 2020
by
Taylor Hanayik
Browse files
add bet center coords
parent
1d90a344
Changes
4
Hide whitespace changes
Inline
Side-by-side
fsl/gui/guis.py
View file @
3fc46784
...
...
@@ -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_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
.
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
.
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
.
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
)
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
):
widget
=
event
.
GetEventObject
()
val
=
widget
.
GetValue
()
...
...
fsl/gui/tools.py
View file @
3fc46784
...
...
@@ -36,6 +36,7 @@ class Bet:
bet_type
=
""
,
fval
=
0.5
,
gval
=
0
,
center_coord
=
(),
discard_bet
=
False
,
save_mask
=
False
,
applythresh
=
False
,
...
...
@@ -51,6 +52,7 @@ class Bet:
self
.
_bet_type
=
bet_type
self
.
_fval
=
fval
self
.
_gval
=
gval
self
.
_center_coord
=
center_coord
self
.
_discard_bet
=
discard_bet
self
.
_save_mask
=
save_mask
self
.
_applythresh
=
applythresh
...
...
@@ -127,6 +129,15 @@ class Bet:
assert
(
val
>=
-
1
)
&
(
val
<=
1
),
"gval must be in the range -1 .. 1"
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
def
discard_bet
(
self
):
return
self
.
_discard_bet
...
...
@@ -225,6 +236,9 @@ class Bet:
def
command
(
self
):
"""
make command line string to call program
"""
FSLDIR
=
os
.
getenv
(
"FSLDIR"
,
None
)
if
FSLDIR
is
None
:
return
False
...
...
@@ -232,6 +246,7 @@ class Bet:
return
False
if
(
len
(
self
.
image_t2
)
>
0
)
&
(
os
.
path
.
isfile
(
self
.
image_t2
)
is
False
):
return
False
cmd
=
[
os
.
path
.
join
(
FSLDIR
,
'bin'
,
'bet'
),
self
.
image_in
,
...
...
@@ -239,6 +254,11 @@ class Bet:
'-f'
,
str
(
self
.
fval
),
'-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
:
if
self
.
_bool_argmap
[
key
]:
cmd
.
append
(
key
)
...
...
fsl/gui/views.py
View file @
3fc46784
...
...
@@ -13,6 +13,9 @@ import fsl.gui.widgets as fslwidgets
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.
"""
def
__init__
(
self
,
*
args
,
**
kwargs
):
...
...
@@ -58,6 +61,25 @@ class BetOptions(wx.CollapsiblePane):
self
.
gval_panel
.
sizer
.
Add
(
self
.
gval_control
,
0
,
wx
.
ALL
,
5
)
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
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
)
...
...
@@ -67,13 +89,17 @@ class BetOptions(wx.CollapsiblePane):
sizer
.
Add
(
self
.
cb_save_skull
,
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
.
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)
pane
.
SetSizer
(
sizer
)
class
BetView
(
wx
.
Panel
):
"""
Bet view defines the graphical layout of widgets for using BET
"""
def
__init__
(
self
,
parent
,
title
=
"BET"
,
**
kwargs
):
super
().
__init__
(
parent
,
**
kwargs
)
self
.
parent
=
parent
...
...
@@ -113,5 +139,15 @@ class BetView(wx.Panel):
self
.
SetSizer
(
sizer
)
class
FslStartup
():
pass
\ No newline at end of file
class
FlirtView
():
"""
FlirtView defines the graphical layout of widgets used in Flirt
"""
class
FslView
():
"""
FslView is the main FSL start window.
"""
fsl/gui/widgets.py
View file @
3fc46784
"""
the widges module provides common widgets that are intended
to be embedded within other FSL guis.
"""
import
os
import
wx
import
fsleyes.overlay
as
fsloverlay
import
fsleyes.displaycontext
as
fsldc
import
fsleyes.views.orthopanel
as
orthopanel
import
fsl.data.image
as
fslimage
from
fsleyes.main
import
embed
import
fsleyes.profiles
as
profiles
import
fsleyes.profiles.profilemap
as
profilemap
from
fsleyes.frame
import
FSLeyesFrame
import
fsl.data.image
as
fslimage
import
fsl.gui.icons
as
fslicons
def
layout_from
(
widget
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment