Skip to content
Snippets Groups Projects
Commit 7bef97b2 authored by Matthew Webster's avatar Matthew Webster
Browse files

less tix, more fix

parent b903acde
No related branches found
No related tags found
No related merge requests found
# MEDx interface for LoadVarian
# Copyright (c) Stuart Clare, FMRIB Centre, University of Oxford.
# Copyright (c) Stuart Clare and Matthew Webster FMRIB Centre, University of Oxford.
#
# This program should be considered a beta test version
# and must not be used for any clinical purposes.
#
# Uses loadvarian_proc.tcl for processing
source [ file dirname [ info script ] ]/lvstart.tcl
set LOAD_VARIAN 1
source [ file dirname [ info script ] ]/fslstart.tcl
set TCLPATH [file dirname [ info script ] ]
regsub tcl $TCLPATH bin BINPATH
regsub tcl $TCLPATH doc/load_varian HTMLPATH
......@@ -14,10 +14,6 @@ regsub tcl $TCLPATH doc/load_varian HTMLPATH
set VERSION [exec $BINPATH/load_varian -version]
# FMRIB TCL functions
source $TCLPATH/FidFolderBox.tcl
source $TCLPATH/FidFolderDlg.tcl
source $TCLPATH/FidFolderInfoBox.tcl
source $TCLPATH/FidFolderInfoDlg.tcl
source $TCLPATH/loadvarian_proc.tcl
proc load_varian:dialog { w } {
......@@ -34,84 +30,34 @@ proc load_varian:dialog { w } {
return
}
toplevel $w
wm title $w "Load Varian Data $VERSION"
wm iconname $w "Load Varian"
wm iconbitmap $w @$FSLDIR/tcl/fmrib.xbm
load_varian:set_default_values
#-------- File Browsers --------
tixFidFolderInfoSelectDialog $w.browser \
-title "Select a Varian FID file..." \
-command "load_varian:setfile $w"
tixFidFolderSelectDialog $w.rbrowser \
-title "Select a Varian FID file..." \
-command "load_varian:rsetfile $w"
FSLFileDirSelectDialog $w.abrowser \
-title "Select an AVW file..." \
-command "set variables(SELECTION)"
$w.abrowser subwidget fsbox config -pattern "IMAGE"
FSLFileDirSelectDialog $w.obrowser \
-title "Select an AVW file..." \
-command "set variables(OUTFILE)"
$w.obrowser subwidget fsbox config -pattern "IMAGE"
load_varian:setinput $w
#-------- Filename --------
#-------- Filename input/output--------output only used outside of MEDx
frame $w.file
frame $w.filef
frame $w.ifile
label $w.ifile.fnamelbl -text "Input filename: " -width 14
entry $w.ifile.filename -textvariable variables(SELECTION) -width 50
button $w.ifile.browse -text "Browse" -command "$w.browser popup"
pack $w.ifile.fnamelbl \
-in $w.ifile -side left -padx 3 -pady 3 -anchor nw
pack $w.ifile.filename -expand yes -fill x \
-in $w.ifile -side left -padx 3 -pady 3 -anchor nw
pack $w.ifile.browse\
-in $w.ifile -side left -padx 3 -pady 3 -anchor nw
#----- Output filename ----
# Only used outside of MEDx
frame $w.ofile
label $w.ofile.fnamelbl -text "Output filename: " -width 14
entry $w.ofile.filename -textvariable variables(OUTFILE) -width 50
button $w.ofile.browse -text "Browse" -command "$w.obrowser popup"
pack $w.ofile.fnamelbl \
-in $w.ofile -side left -padx 3 -pady 3 -anchor nw
pack $w.ofile.filename -expand yes -fill x \
-in $w.ofile -side left -padx 3 -pady 3 -anchor nw
pack $w.ofile.browse \
-in $w.ofile -side left -padx 3 -pady 3 -anchor nw
pack $w.ifile -in $w.filef -side top -anchor nw -expand yes -fill x
pack $w.ofile -in $w.filef -side top -anchor nw -expand yes -fill x
pack $w.filef -in $w.file -pady 7 -expand yes -fill x
FileEntry $w.file.ifile -textvariable variables(SELECTION) -label "Input filename: " -title "Select a Varian FID file" -width 45 -filedialog 3panel -filetypes * -command "load_varian:setfile $w" -dirasfile fid
FileEntry $w.file.ofile -textvariable variables(OUTFILE) -label "Output filename:" -title "Select an AVW file" -width 45 -filetypes IMAGE
pack $w.file.ifile $w.file.ofile -side top -anchor nw -expand yes -fill x
#-------- Options --------
collapsible frame $w.opts -title "Options"
#-------- Notebook --------
tixNoteBook $w.nb -ipadx 5 -ipady 5
$w.nb add load -label " Load "
$w.nb add multi -label "Process"
$w.nb add epi -label " EPI "
$w.nb add par -label "Procpar"
$w.nb add save -label "Save"
$w.nb add adv -label "Advanced" -raisecmd "load_varian:setadv $w"
NoteBook $w.nb -side top -bd 2 -tabpady {5 10} -arcradius 3
$w.nb insert 0 load -text " Load "
$w.nb insert 1 multi -text "Process"
$w.nb insert 2 epi -text " EPI "
$w.nb insert 3 par -text "Procpar"
$w.nb insert 4 save -text "Save"
$w.nb insert 5 adv -text "Advanced" -raisecmd "load_varian:setadv $w"
$w.nb raise load
#-------- Load Options --------
set loadf [$w.nb subwidget load]
set loadf [$w.nb getframe load]
frame $w.load
label $w.load.label -text "Load volumes:"
......@@ -208,7 +154,7 @@ proc load_varian:dialog { w } {
pack $w.load -in $loadf -side top -pady 3 -padx 6 -anchor nw
#-------- General Options --------
set msf [$w.nb subwidget multi]
set msf [$w.nb getframe multi]
frame $w.ms
......@@ -351,7 +297,7 @@ proc load_varian:dialog { w } {
pack $w.ms -in $msf -side top -pady 3 -padx 6 -anchor nw
#-------- EPI Options --------
set epif [$w.nb subwidget epi]
set epif [$w.nb getframe epi]
frame $w.epi
......@@ -411,18 +357,14 @@ proc load_varian:dialog { w } {
grid $w.epi.entropy -row 3 -column 2 -sticky w -in $w.epi -padx 3 -pady 3
grid $w.epi.entropyi -row 3 -column 3 -sticky w -in $w.epi -padx 3 -pady 3
label $w.epi.label -text "Reference scan:"
entry $w.epi.filename -textvariable variables(REFNAME) -width 50
button $w.epi.browse -text "Browse" -command "$w.rbrowser popup"
FileEntry $w.epi.rfile -textvariable variables(REFNAME) -label "Reference Scan: " -title "Select a Varian FID file..." -width 45 -filetypes *
grid $w.epi.label -row 4 -column 1 -sticky w -in $w.epi -padx 3 -pady 3
grid $w.epi.filename -row 4 -column 2 -columnspan 4 -sticky w -in $w.epi -padx 3 -pady 3
grid $w.epi.browse -row 5 -column 2 -sticky w -in $w.epi -padx 3 -pady 3
grid $w.epi.rfile -columnspan 4 -row 4 -column 1 -sticky w -in $w.epi -padx 3 -pady 3
pack $w.epi -in $epif -side top -pady 3 -padx 6 -anchor nw
#-------- Procpar file --------
set parf [$w.nb subwidget par]
set parf [$w.nb getframe par]
frame $w.par
label $w.par.xlbl -text "Points per line: "
......@@ -461,7 +403,7 @@ proc load_varian:dialog { w } {
pack $w.par -in $parf -side top -anchor nw
#-------- Save Options --------
set savef [$w.nb subwidget save]
set savef [$w.nb getframe save]
frame $w.save
label $w.save.zlbl -text "Format: "
......@@ -517,7 +459,7 @@ proc load_varian:dialog { w } {
pack $w.save -in $savef -side top -anchor nw
#-------- Advanced Options --------
set advf [$w.nb subwidget adv]
set advf [$w.nb getframe adv]
frame $w.options
scrollbar $w.options.sbar -command "$w.options.text yview"
......@@ -717,7 +659,7 @@ proc load_varian:showhide { w } {
}
}
proc load_varian:avwin { w } {
#This proc is NOT NEEDED (and not called!)
global variables
if {$variables(avw)==1} {
......@@ -746,8 +688,6 @@ proc load_varian:setinput { w } {
}
set variables(OUTFILE) [ file rootname $variables(SELECTION) ]
load_varian:outfile_ext
$w.browser subwidget fsbox config -directory [file dirname $variables(SELECTION)]
$w.rbrowser subwidget fsbox config -directory [file dirname $variables(SELECTION)]
}
}
proc load_varian:outfile_ext { } {
......@@ -774,28 +714,18 @@ proc load_varian:outfile_ext { } {
set variables(OUTFILE) "$variables(OUTFILE).hdr"
}
}
proc load_varian:rsetfile {w filename} {
global variables
set variables(REFNAME) $filename
}
proc load_varian:setfile {w filename} {
global variables
proc load_varian:setfile {w filename} {
global variables
load_varian:set_process_defaults
#set SELECTION if setfile called in command line mode
set variables(SELECTION) $filename
load_varian:get_seqtype $w $variables(SELECTION)
load_varian:get_nD $w $variables(SELECTION)
load_varian:get_fmap $w $variables(SELECTION)
load_varian:setprocpar
set DIR [file dirname $variables(SELECTION)]
$w.rbrowser subwidget fsbox config -directory $DIR
set fn [ file rootname $filename ]
set variables(OUTFILE) $fn
load_varian:setprocpar
set variables(OUTFILE) [ file rootname $filename ]
load_varian:outfile_ext
$w.obrowser subwidget fsbox config -directory [file dirname $variables(OUTFILE)]
}
proc load_varian:get_seqtype { w filename } {
......
# test for whether we are in tclsh or wish
if { [ string first tclsh [ file tail [ info nameofexecutable ] ] ] != 0 } {
package require Tix
tix configure -scheme TixGray
option add *AutoRepeat false
}
set FSLCONVERT $env(FSLCONVERT)
set FSLGNUPLOT $env(FSLGNUPLOT)
set FSLDIR $env(FSLDIR)
set FSLCONVERT $env(FSLCONVERT)
set FSLGNUPLOT $env(FSLGNUPLOT)
set FSLOUTPUTTYPE $env(FSLOUTPUTTYPE)
set FSLTCLSH $env(FSLTCLSH)
set FSLWISH $env(FSLWISH)
set FSLDISPLAY $env(FSLDISPLAY)
set FSLBROWSER $env(FSLBROWSER)
set FSLTCLSH $env(FSLTCLSH)
set FSLWISH $env(FSLWISH)
set FSLDISPLAY $env(FSLDISPLAY)
set FSLBROWSER $env(FSLBROWSER)
set USER $env(USER)
set HOME [ exec sh -c " cd ; pwd " ]
......@@ -21,22 +14,56 @@ set PROCID [ pid ]
set HOSTNAME [ exec hostname ]
set OS [ exec uname ]
# set FSLDIR from environment
set FSLDIR $env(FSLDIR)
set auto_path [ linsert $auto_path 0 $FSLDIR/tcl ]
# test for whether we are in tclsh or wish
if { [ info exists env(TCLTKSHELL) ] && $env(TCLTKSHELL) == "wish" } {
package require Tk
#option add *AutoRepeat false
tk_focusFollowsMouse
option add *Font {Helvetica 10} widgetDefault
# uncomment below for original notebook
# option add *NoteBook.font {Helvetica 9}
# uncomment below for bold labels
# option add *Label.font {Helvetica 10 bold}
option add *NoteBook.font {Helvetica 10 bold}
option add *Foreground black
option add *highlightBackground lightgray
option add *background lightgray
option add *FileEntry.Background grey95
option add *Scrollbar.Background grey60
option add *Entry.Background grey95
option add *highlightColor grey86
option add *activeBackground grey86
option add *Checkbutton*selectColor #ffff00
option add *Radiobutton*selectColor #ffff00
option add *Listbox.background grey95
option add *activeforeground #b0b0ff
option add *troughColor grey95
option add *selectBackground #b0b0ff
option add *disabledBackground #ffb0b0
option add *disabledForeground grey77
#New options for Spinbox...
option add *Entry.validate focusout
option add *SpinBox.vcmd2 {validNum %W %V %P %s [lindex [[string range %W 0 end-2] cget -range] 0] [lindex [[string range %W 0 end-2] cget -range] 1]}
option add *SpinBox.invcmd2 { set [%W cget -textvariable] $tempSpin; %W config -validate %v }
option add *Entry.width 4
#instead of using -disabledforeground #c4c4c4 in front of all notebooks
option add *insertBackground #ffb0b0
# for running outside of FMRIB don't try to renice
if { [ file exists /usr/local/bin/nicemedx ] } {
set RENICE 1
} else {
set RENICE 0
lappend auto_path $FSLDIR/tcl/bwidget
package require BWidget
package require BWFileEntry
package require BWLabelComboBox
package require BWLabelSpinBox
}
if { ! [ info exists INGUI ] } {
source $FSLDIR/tcl/FSLFileDirBox.tcl
source $FSLDIR/tcl/FSLFileDirDlg.tcl
source $FSLDIR/tcl/FSLFileEntry.tcl
}
#Choose load_varian specific OR FSLPARALLEL
if { [ info exists LOAD_VARIAN ] && $LOAD_VARIAN == 1 } {
if { [ file exists /usr/local/bin/nicemedx ] } { set RENICE 1 } else { set RENICE 0 }
} else {
set FSLPARALLEL 0
if { [ info exists env(SGE_ROOT) ] && $env(SGE_ROOT) != "" } { set FSLPARALLEL 1 }
}
# what type of OS?
set OSFLAVOUR unix
......@@ -51,4 +78,3 @@ if { $UNAME == "Darwin" } {
set gui_ext "_gui"
set FSLSLASH "C:/cygwin"
}
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