Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
melodic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
melodic
Commits
3a316b72
Commit
3a316b72
authored
17 years ago
by
Stephen Smith
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
b0a3d565
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
melodic.tcl
+201
-431
201 additions, 431 deletions
melodic.tcl
with
201 additions
and
431 deletions
melodic.tcl
+
201
−
431
View file @
3a316b72
#{{{ copyright and setup
# MELODIC - Multivariate Exploratory Linear Optimized Decomposition into
# Independent Components
#
#
# Christian Beckmann, Stephen Smith and Matthew Webster, FMRIB Image Analysis Group
# GUI for MELODIC
#
# Stephen Smith & Christian Beckmann, FMRIB Analysis Group
#
#
# Copyright (C) 200
6
University of Oxford
# Copyright (C)
1999-
200
7
University of Oxford
#
#
# TCLCOPYRIGHT
# TCLCOPYRIGHT
source
[
file dirname
[
info script
]
]
/fslstart.tcl
source
[
file dirname
[
info script
]
]
/fslstart.tcl
set VARS
(
history
)
{}
set VARS
(
history
)
{}
set VERSION
[
exec sh -c
"
${FSLDIR}
/bin/melodic -V | awk '{ print
\$
3 }'"
]
#}}}
#{{{ melodic:updatedim
#{{{ main GUI
proc melodic
{
w
}
{
#
{{{
vars and setup
proc melodic:updatedim
{
w
}
{
global vars FSLDIR INMEDX argc argv PWD VERSION entries fmri
toplevel $w
wm title $w
"MELODIC - v
$
VERSION"
wm iconname $w
"MELODIC"
wm iconbitmap $w @$
{
FSLDIR
}
/tcl/fmrib.xbm
frame $w.f
global fmri
set f $fmri
(
statsf
)
if
{
$fmri
(
dim_yn
)
== 1
}
{
pack forget $f.dim.n
}
else
{
pack $f.dim.n -in $f.dim -side left -padx 5 -after $f.dim.yn
}
$w.nb compute_size
}
#}}}
#}}}
#{{{ melodic:updatethresh
NoteBook $w.nb -side top -bd 2 -tabpady
{
5 10
}
-arcradius 3
proc melodic:updatethresh
{
w
}
{
$w.nb insert 0 data -text
"Data"
$w.nb insert 1 filtering -text
"Pre-stats"
$w.nb insert 2 melodic -text
"MELODIC"
#
{{{
Data
set fmri
(
dataf
)
[
$w.nb getframe data
]
#{{{ multiple analyses
frame $w.multiple
set fmri
(
multiple
)
1
LabelSpinBox $w.multiple.number -label
"Number of analyses "
-textvariable fmri
(
multiple
)
-range
" 1 10000 1 "
-width 3
set fmri
(
level
)
1
set fmri
(
analysis
)
0
set fmri
(
inputtype
)
2
button $w.multiple.setup -text
"Select 4D data"
-command
"feat5:multiple_select
$w
0
\"
Select input data
\"
"
global fmri
set f $fmri
(
poststatsf
)
.thresh
pack $w.multiple.number $w.multiple.setup -in $w.multiple -side left -padx 5
if
{
$fmri
(
thresh_yn
)
== 0
}
{
set fmri
(
mmthresh
)
0
pack forget $f.n
}
else
{
set fmri
(
mmthresh
)
0.5
pack $f.n -in $f -side left -padx 5 -after $f.yn
}
}
#}}}
#}}}
#{{{ melodic:apply
#{{{ output directory
proc melodic:apply
{
w
}
{
global fmri feat_files unwarp_files unwarp_files_mag initial_highres_files highres_files FSLDIR HOME
set fmri
(
outputdir
)
""
if
{
[
feat5:write $w 0 1 1 $fmri
(
feat_filename
)
]
}
{
FileEntry $w.outputdir -textvariable fmri
(
outputdir
)
-label
" Output directory "
-title
"Name the output directory"
-width 35 -filedialog directory -filetypes
{
}
return 1
#}}}
}
frame $w.datamain
#{{{ npts & ndelete
frame $w.nptsndelete
set FSFROOT
[
file rootname $fmri
(
feat_filename
)
]
#{{{ ndelete
catch
{
exec sh -c
"
$
FSLDIR/bin/feat
$
FSFROOT"
&
}
junk
set fmri
(
ndelete
)
0
set fmri
(
feat_filename
)
[
exec sh -c
"
${FSLDIR}
/bin/tmpnam /tmp/feat"
]
.fsf
LabelSpinBox $w.ndelete -label
" Delete volumes "
-textvariable fmri
(
ndelete
)
-range
{
0 200000 1
}
-width 3
balloonhelp_for $w.ndelete
"The number of initial FMRI volumes to delete before any further
processing. These should be the volumes that are not wanted because
steady-state imaging has not yet been reached - typically two or three
volumes."
#}}}
pack $w.ndelete -in $w.nptsndelete -side left
update idletasks
}
#}}}
#}}}
#{{{ TR & highpass
frame $w.trparadigm_hp
proc melodic
{
w
}
{
global fmri FSLDIR USER feat_files unwarp_files unwarp_files_mag initial_highres_files highres_files VARS argc argv PWD gui_ext HOME tempSpin
#{{{ TR
set fmri
(
tr
)
3.0
#
{{{
main window
LabelSpinBox $w.tr -label
"TR (s) "
-textvariable fmri
(
tr
)
-range
{
0.001 200000 0.25
}
balloonhelp_for $w.tr
"The time (in seconds) between scanning successive FMRI volumes."
#}}}
pack $w.tr -in $w.trparadigm_hp -side left
feat5:setupdefaults
#}}}
set tempSpin -1
pack $w.nptsndelete $w.trparadigm_hp -in $w.datamain -side top -padx 5 -pady 3 -anchor w
pack $w.multiple $w.datamain -in $fmri
(
dataf
)
-anchor w -side top
toplevel $w
#{{{ FSL logo
set melodic_version
[
fsl:exec
"
$
FSLDIR/bin/melodic -V"
-n
]
set fmri
(
version
)
[
lindex $melodic_version 2
]
set graphpic
[
image create photo -file $
{
FSLDIR
}
/tcl/fsl-logo-tiny.ppm
]
wm title $w $melodic_version
button $w.logo -image $graphpic -command
"FmribWebHelp file:
${FSLDIR}
/doc/index.html"
-borderwidth 0
wm iconname $w $melodic_version
pack $w.logo -in $fmri
(
dataf
)
-anchor e -side bottom -padx 5 -pady 5
wm iconbitmap $w @$
{
FSLDIR
}
/tcl/fmrib.xbm
#}}}
set fmri
(
inmelodic
)
1
set fmri
(
level
)
1
set fmri
(
analysis
)
7
set fmri
(
icaopt
)
1
set fmri
(
regstandard_res
)
4
#}}}
#}}}
#
{{{
Pre-statistics processing
#
{{{
notebook
set fmri
(
filteringf
)
[
$w.nb getframe filtering
]
NoteBook $w.nb -side top -bd 2 -tabpady
{
5 10
}
-arcradius 3
$w.nb
insert 0 misc -text
"Misc"
$w.nb
insert 1 data -text
"Data"
$w.nb
insert 2 filtering -text
"Pre-Stats"
$w.nb
insert 3 reg -text
"Registration"
$w.nb
insert 4 stats -text
"Stats"
$w.nb
insert 5 poststats -text
"Post-Stats"
set fmri
(
filtering_yn
)
1
#{{{ Misc
#{{{ motion correction
set fmri
(
miscf
)
[
$w.nb getframe misc
]
LabelFrame $w.mc -text
"Motion correction: "
feat5:misc_gui $w
set fmri
(
mcf
)
$w.mc
optionMenu2 $w.mc.menu fmri
(
mc
)
0
"None"
1
"MCFLIRT"
pack $w.mc.menu
balloonhelp_for $w.mc
"You will normally want to apply motion correction; this attempts to
remove the effect of subject head motion during the
experiment. MCFLIRT uses FLIRT (FMRIB's Linear Registration Tool)
tuned to the problem of FMRI motion correction, applying rigid-body
transformations."
#}}}
#{{{ Data
set fmri
(
mc
)
1
set fmri
(
dataf
)
[
$w.nb getframe data
]
feat5:data_gui $w
#}}}
#}}}
#{{{ slice timing correction
#{{{ Pre-ICA
LabelFrame $w.st -text
"Slice timing correction: "
set fmri
(
stf
)
$w.st
set fmri
(
st
)
0
set fmri
(
st_file
)
""
FileEntry $w.st_file -textvariable fmri
(
st_file
)
-label
""
-title
"Select a slice order/timings file"
-width 20 -filedialog directory -filetypes *
optionMenu2 $w.st.menu fmri
(
st
)
-command
"melodic2:updatest
$w
"
0
"None"
1
"Regular up (0, 1, 2 ... n-1)"
2
"Regular down (n-1, n-2 ... 0)"
5
"Interleaved (0, 2, 4 ... 1, 3, 5 ... )"
3
"Use slice order file"
4
"Use slice timings file"
pack $w.st.menu
balloonhelp_for $w.st
"Slice timing correction corrects each voxel's time-series for the fact
that later processing assumes that all slices were acquired exactly
half-way through the relevant volume's acquisition time (TR), whereas
in fact each slice is taken at slightly different times.
Slice timing correction works by using (Hanning-windowed) sinc
interpolation to shift each time-series by an appropriate fraction of
a TR relative to the middle of the TR period. It is necessary to know
in what order the slices were acquired and set the appropriate option
here.
If a slice order file is to be used (e.g., to setup interleaved slice
orderings), create a text file with a single number on each line,
where the first line states which slice was acquired first, the second
line states which slices was acquired second, etc. The first slice is
numbered 1 not 0."
#}}}
set fmri
(
filteringf
)
[
$w.nb getframe filtering
]
#{{{ BET brain extraction
f
rame $w.bet
f
eat5:prestats_gui $w
label $w.bet.label -text
"BET brain extraction"
#}}}
#{{{ ICA
set fmri
(
bet_yn
)
1
set fmri
(
statsf
)
[
$w.nb getframe stats
]
checkbutton $w.bet.yn -variable fmri
(
bet_yn
)
-command
"melodic2:updatebet
$w
"
balloonhelp_for $w.bet
"This uses BET brain extraction to create a brain mask from the first
set f $fmri
(
statsf
)
volume in the FMRI data. This is normally better than simple
intensity-based thresholding for getting rid of unwanted voxels in
FMRI data. Note that here, BET is setup to run in a quite liberal way so that
there is very little danger of removing valid brain voxels.
If the field-of-view of the image (in any direction) is less than 30mm
#{{{ variance normalisation
then BET is turned off by default."
set fmri
(
varnorm
)
1
checkbutton $f.varnorm -variable fmri
(
varnorm
)
-text
"Variance-normalise timecourses"
balloonhelp_for $f.varnorm
"When switched on, Melodic will rescale each time series so
that the estimation is more influenced by the voxel-wise
temporal dynamics and less by a voxels' mean signal. "
set fmri
(
thresh
)
10
#}}}
LabelSpinBox $w.bet.thresh -label
" Threshold % "
-textvariable fmri
(
thresh
)
-range
{
0.0 100 1
}
-width 3
#{{{ output components
pack $w.bet.label $w.bet.yn -in $w.bet -side left
frame $f.dim
#}}}
set fmri
(
dim_yn
)
1
#{{{ spatial filtering
checkbutton $f.dim.yn -variable fmri
(
dim_yn
)
-text
"Automatic dimensionality estimation"
-command
"melodic:updatedim
$w
"
set fmri
(
smooth
)
3
pack $f.dim.yn -in $f.dim -side left
LabelSpinBox $w.smooth -label
"Spatial smoothing FWHM (mm) "
-textvariable fmri
(
smooth
)
-range
{
0.0 10000 1
}
-width 3
balloonhelp_for $w.smooth
"This determines the extent of the spatial smoothing, carried out on
balloonhelp_for $f.dim
"In order to avoid overfitting, Melodic will attempt to estimate the number of
each volume of the FMRI data set separately. This is intended to
components from the data using Bayesian estimators for the model
reduce noise without reducing interesting signal; this is successful as
order and use PCA to reduce the data prior to the IC estimation."
long as the underlying signal area is larger than the extent of
the smoothing.
To turn off spatial smoothing simply set FWHM to 0."
set fmri
(
dim
)
1
LabelSpinBox $f.dim.n -label
"Output components"
-textvariable fmri
(
dim
)
-range
{
1 200000 1
}
#}}}
#}}}
#{{{ temporal filtering
#{{{ ICA level
frame $w.temp
label $w.temp.label -text
"Temporal filtering
"
optionMenu2 $f.icaopt fmri
(
icaopt
)
-command
"feat5:updatereg
$w
"
1
"Single-session ICA"
2
"Multi-session temporal concatenation"
3
"Multi-session tensor ICA
"
set fmri
(
temphp_yn
)
1
balloonhelp_for $f.icaopt
"
label $w.temp.hplabel -text
"Highpass (s)"
checkbutton $w.temp.hp_yn -variable fmri
(
temphp_yn
)
set fmri
(
templp_yn
)
0
Here you can select the kind of ICA-based analysis you want to run.
balloonhelp_for $w.temp
" The high pass frequency cutoff point (in seconds) specifies
If you want to process a single-session FMRI dataset (or several
the longest temporal period you will allow.
datasets with the same setup, but independently of each other) then
select
\"
Single-session ICA
\"
. This runs a standard (space X time) ICA
decomposition on each of the input datasets separately.
\"
Highpass temporal filtering
\"
uses a local fit of a
If you want to process several sessions or subjects simultaneously,
straight line (Gaussian-weighted within the line to give
constraining the spatial maps to be the same across sessions/subjects,
a smooth response) to remove low frequency artefacts. It
but with no constraint on the timecourses being the same, then you
is generally beneficial to remove global trends which
might want to choose the
\"
Multi-session temporal concatenation
\"
will - if not removed - often dominate the decomposition."
option. After transforming all sessions' 4D datasets into standard
space, they are all temporally concatenated together, resulting in one
large 4D dataset. Then a standard (space X time) ICA decomposition is
run.
set fmri
(
paradigm_hp
)
100
If you want to process several sessions or subjects simultaneously,
LabelSpinBox $w.paradigm_hp -textvariable fmri
(
paradigm_hp
)
-range
{
1.0 200000 5
}
-width 5
and you want to constrain both spatial maps and timecourses to be the
same across the session/subjects, then you should choose the
\"
Multi-session tensor ICA
\"
option. After transforming all sessions'
4D datasets into standard space, they are combined together and tensor
(space X time X sessions/subjects) ICA is run.
pack $w.temp.label $w.temp.hplabel $w.temp.hp_yn $w.paradigm_hp -in $w.temp -side top -side left
For analysis of multi-session or multi-subject resting FMRI data, in
order to find resting-state networks, we generally recommend using the
temporal concatenation option. In all other cases in general we
recommend using the Tensor ICA option."
#}}}
#}}}
pack $f
mri
(
mcf
)
$fmri
(
stf
)
$w.bet $w.smooth $w.temp -in $fmri
(
filteringf
)
-anchor w -pady 1 -padx 5
pack $f
.varnorm $f.dim $f.icaopt -in $f -anchor w -side top
#}}}
#}}}
#
{{{
Melodic
#{{{ Post-ICA
set fmri
(
melodicf
)
[
$w.nb getframe melodic
]
set fmri
(
varnorm
)
1
checkbutton $w.varnorm -variable fmri
(
varnorm
)
-text
"Variance-normalise timecourses"
balloonhelp_for $w.varnorm
"When switched on, Melodic will rescale each time series so
that the estimation is more influenced by the voxel-wise
temporal dynamics and less by a voxels' mean signal. "
#{{{ output components
frame $w.dim
set fmri
(
poststatsf
)
[
$w.nb getframe poststats
]
set fmri
(
dim_yn
)
1
set f $fmri
(
poststatsf
)
checkbutton $w.dim.yn -variable fmri
(
dim_yn
)
-text
"Automatic dimensionality estimation"
-command
"melodic2:updatedim
$w
"
pack $w.dim.yn -in $w.dim -side left
balloonhelp_for $w.dim
"In order to avoid overfitting, Melodic will attempt to estimate the number of
components from the data using Bayesian estimators for the model
order and use PCA to reduce the data prior to the IC estimation."
set fmri
(
dim
)
1
LabelSpinBox $w.dim.n -label
"Output components"
-textvariable fmri
(
dim
)
-range
{
1 200000 1
}
#}}}
#{{{ thresholding
#{{{ thresholding
frame $
w
.thresh
frame $
f
.thresh
set fmri
(
thresh_yn
)
1
set fmri
(
thresh_yn
)
1
checkbutton $
w
.thresh.yn -variable fmri
(
thresh_yn
)
-text
"Threshold IC maps"
-command
"melodic
2
:updatethresh
$w
"
checkbutton $
f
.thresh.yn -variable fmri
(
thresh_yn
)
-text
"Threshold IC maps"
-command
"melodic:updatethresh
$w
"
balloonhelp_for $
w
.thresh
"M
elodic
uses a mixture model approach to assign significance to individual
balloonhelp_for $
f
.thresh
"M
ELODIC
uses a mixture model approach to assign significance to individual
voxels within a spatial map. The mixture model of a single Gaussian
voxels within a spatial map. The mixture model of a single Gaussian
distribution (for the background noise within the spatial maps) and
distribution (for the background noise within the spatial maps) and
2 Gamma distributions (which model the 'active' voxels contained in
2 Gamma distributions (which model the 'active' voxels contained in
the tails of the Gaussian) is fitted to the intensity histogram of
the tails of the Gaussian) is fitted to the intensity histogram of
the Z-transformed IC maps using a restricted EM algorithm.
the Z-transformed IC maps using a restricted EM algorithm.
From this mixture model fit, M
elodic
calculates voxel-wise probabilities
From this mixture model fit, M
ELODIC
calculates voxel-wise probabilities
of 'activation' (as the ratio of a voxels' intensity being in the
of 'activation' (as the ratio of a voxels' intensity being in the
non-background class relative to probability of the intensity being
non-background class relative to probability of the intensity being
background noise).
background noise).
...
@@ -283,305 +221,137 @@ where the probability of belonging to the non-background mixtures
...
@@ -283,305 +221,137 @@ where the probability of belonging to the non-background mixtures
exceeds the probability of the voxel belonging to the background
exceeds the probability of the voxel belonging to the background
noise Gaussian."
noise Gaussian."
set fmri
(
mmthresh
)
"
0.5
"
set fmri
(
mmthresh
)
0.5
entry
$
w
.thresh.n -textvariable fmri
(
mmthresh
)
-width
10
LabelSpinBox
$
f
.thresh.n
-label
""
-textvariable fmri
(
mmthresh
)
-range
{
0.0 1 0.1
}
-width
3
pack $
w
.thresh.yn $
w
.thresh.n -in $
w
.thresh -side left
pack $
f
.thresh.yn $
f
.thresh.n -in $
f
.thresh -side left
#}}}
#}}}
#{{{ background image for group stats
set fmri
(
ostats
)
0
frame $f.bgimage
checkbutton $w.ostats -variable fmri
(
ostats
)
-text
"Output full stats folder"
balloonhelp_for $w.ostats
"
When switched on, Melodic will save the thresholded IC
maps and the probability maps inside a folder
\/
stats.
This will substantially increase the amount of space used,
so only switch this on if you intend to use these maps."
label $f.bgimage.label -text
"Background image "
optionMenu2 $f.bgimage.menu fmri
(
bgimage
)
1
"Mean highres"
2
"First highres"
3
"Mean functional"
4
"First functional"
5
"Standard space template"
set fmri
(
report
)
1
pack $f.bgimage.label $f.bgimage.menu -in $f.bgimage -side top -side left
checkbutton $w.report -variable fmri
(
report
)
-text
"Create web page report"
balloonhelp_for $f.bgimage
"With
\"
Higher-level analysis
\"
you can select what image will be used
as the background image for the activation colour overlays. The
default of
\"
Mean highres
\"
is probably the best for relating
activation to underlying structure. For a sharper underlying image,
(but one which is not so representative of the group of subjects), you
can instead choose to use the highres image from the first selected
subject.
pack $w.varnorm $w.dim $w.thresh $w.ostats $w.report -in $fmri
(
melodicf
)
-anchor w -side top
You can alternatively choose to use the original lowres functional
data for the overlays, or the standard-space template image."
#}}}
#}}}
#{{{ output options
pack $w.nb -in $w.f -side top -padx 5 -pady 5 -anchor w
set fmri
(
ostats
)
0
checkbutton $f.ostats -variable fmri
(
ostats
)
-text
"Output full stats folder"
#
{{{
Button Frame
frame $w.btns
frame $w.btns.b -relief raised -borderwidth 1
button $w.apply -command
"melodic2:apply
$w
keep"
\
-text
"Go"
-width 5
bind $w.apply <Return>
{
[
winfo toplevel %W
]
.apply invoke
}
button $w.cancel -command
"melodic2:destroy
$w
"
\
-text
"Exit"
-width 5
bind $w.cancel <Return>
{
[
winfo toplevel %W
]
.cancel invoke
}
button $w.help -command
"FmribWebHelp file:
${FSLDIR}
/doc/melodic2/index.html"
\
-text
"Help"
-width 5
bind $w.help <Return>
{
[
winfo toplevel %W
]
.help invoke
}
pack $w.btns.b -side bottom -fill x
pack $w.apply $w.cancel $w.help -in $w.btns.b
\
-side left -expand yes -padx 3 -pady 10 -fill y
pack $w.f $w.btns -expand yes -fill both
$w.nb raise data
#}}}
}
#}}}
#{{{ melodic2:updatest
proc melodic2:updatest
{
w
}
{
global fmri
if
{
$fmri
(
st
)
== 3 || $fmri
(
st
)
== 4
}
{
balloonhelp_for $f.ostats
"
pack $w.st_file -in $fmri
(
stf
)
-side left -padx 5
When switched on, Melodic will save the thresholded IC
}
else
{
maps and the probability maps inside a folder
\/
stats.
pack forget $w.st_file
This will substantially increase the amount of space used,
}
so only switch this on if you intend to use these maps."
$w.nb compute_size
}
#}}}
#}}}
#{{{ melodic2:updatebet
proc melodic2:updatebet
{
w
}
{
global fmri
pack $f.thresh $f.bgimage $f.ostats -in $f -anchor w -side top
if
{
$fmri
(
bet_yn
)
== 1
}
{
pack forget $w.bet.thresh
}
else
{
pack $w.bet.thresh -in $w.bet -side left -padx 5 -after $w.bet.yn
}
}
#}}}
#}}}
#{{{ melodic2:updatedim
#{{{ Registration
proc melodic2:updatedim
{
w
}
{
global fmri
set fmri
(
regf
)
[
$w.nb getframe reg
]
if
{
$fmri
(
dim_yn
)
== 1
}
{
feat5:reg_gui $w
pack forget $w.dim.n
}
else
{
pack $w.dim.n -in $w.dim -side left -padx 5 -after $w.dim.yn
}
$w.nb compute_size
}
#}}}
#}}}
#{{{ melodic2:updatethresh
proc melodic2:updatethresh
{
w
}
{
set fmri
(
level
)
1
set fmri
(
analysis
)
7
global fmri
set tmpval $fmri
(
paradigm_hp
)
feat5:updatelevel $w
set fmri
(
paradigm_hp
)
$tmpval
if
{
$fmri
(
thresh_yn
)
== 0
}
{
$w.nb
raise data
set fmri
(
mmthresh
)
0
pack forget $w.thresh.n
}
else
{
set fmri
(
mmthresh
)
"0.5"
pack $w.thresh.n -in $w.thresh -side left -padx 5 -after $w.thresh.yn
}
}
#}}}
#}}}
#{{{
melodic2:apply
#
{{{
button Frame
proc melodic2:apply
{
w dialog
}
{
frame $w.btns
global fmri HOME FSLDIR INMEDX entries feat_files logout
for
{
set session 1
}
{
$session <= $fmri
(
multiple
)
}
{
incr session 1
}
{
button $w.btns.apply -command
"melodic:apply
$w
"
-text
"Go"
#
{{{
setup filenames
set INPUT
[
remove_ext $feat_files
(
$session
)
]
set OUTPUT
[
new_filename $
{
INPUT
}
.ica
]
button $w.btns.save -command
"feat_file:setup_dialog
$w
a a a
[
namespace current
]
*.fsf {Save Feat setup} {feat5:write
$w
1 1 0} {}"
-text
"Save"
if
{
!
[
file writable
[
file dirname $OUTPUT
]
]
}
{
set OUTPUT
[
new_filename $
{
HOME
}
/
[
file tail $OUTPUT
]
]
}
fsl:exec
"mkdir
$
OUTPUT"
cd $OUTPUT
set logout $
{
OUTPUT
}
/report.log
#}}}
#
{{{
prestats
#{{{ delete volumes
set total_volumes
[
exec sh -c
"
${FSLDIR}
/bin/avwnvols
$
INPUT 2> /dev/null"
]
if
{
$fmri
(
ndelete
)
> 0
}
{
set total_volumes
[
expr $total_volumes - $fmri
(
ndelete
)
]
fsl:exec
"
${FSLDIR}
/bin/avwroi
$
INPUT prefiltered_func_data
$fmri
(ndelete)
$total
_volumes"
set INPUT prefiltered_func_data
}
set target_vol_number
[
expr $total_volumes / 2
]
button $w.btns.load -command
"feat_file:setup_dialog
$w
a a a
[
namespace current
]
*.fsf {Load Feat setup} {feat5:load
$w
1} {}"
-text
"Load"
fsl:exec
"
${FSLDIR}
/bin/avwroi
$
INPUT example_func
$target
_vol_number 1"
#}}}
button $w.btns.cancel -command
"destroy
$w
"
-text
"Exit"
#{{{ motion correction
if
{
$fmri
(
mc
)
!= 0
}
{
button $w.btns.help -command
"FmribWebHelp file:
${FSLDIR}
/doc/melodic3/index.html"
-text
"Help"
fsl:exec
"
${FSLDIR}
/bin/mcflirt -in
$
INPUT -out prefiltered_func_data_mcf -refvol
$target
_vol_number"
-t 15
set INPUT prefiltered_func_data_mcf
}
#}}}
#{{{ Utils
#{{{ slice timing correction
if
{
$fmri
(
st
)
> 0
}
{
menubutton $w.btns.utils -text
"Utils"
-menu $w.btns.utils.menu -relief raised -bd 2
set st_opts
""
menu $w.btns.utils.menu
switch $fmri
(
st
)
{
2
{
set st_opts
"--down"
}
3
{
set st_opts
"--ocustom=
$fmri
(st_file)"
}
4
{
set st_opts
"--tcustom=
$fmri
(st_file)"
}
}
fsl:exec
"
${FSLDIR}
/bin/slicetimer -i
$
INPUT --out=prefiltered_func_data_st -r
$fmri
(tr)
$st
_opts"
$w.btns.utils.menu
add command -label
"High-res FEAT stats colour rendering"
-command
{
exec sh -c
"
${FSLDIR}
/bin/Renderhighres
$gui
_ext"
&
}
set INPUT prefiltered_func_data_st
}
#}}}
#}}}
#{{{ BET
if
{
$fmri
(
bet_yn
)
}
{
#pack $w.btns.apply $w.btns.save $w.btns.load $w.btns.cancel $w.btns.help $w.btns.utils -in $w.btns -side left -expand yes
fsl:exec
"
${FSLDIR}
/bin/bet
$
INPUT prefiltered_func_data_bet -F"
pack $w.btns.apply $w.btns.save $w.btns.load $w.btns.cancel $w.btns.help -in $w.btns -side left -expand yes
set INPUT prefiltered_func_data_bet
}
#}}}
#}}}
#{{{ filtering
set thecommand
"
${FSLDIR}
/bin/ip
$
INPUT filtered_func_data
$fmri
(thresh)"
if
{
$fmri
(
smooth
)
> 0.01
}
{
set thecommand
"
$thecommand
-s
[
expr $fmri
(
smooth
)
/ 2.355
]
"
}
if
{
$fmri
(
temphp_yn
)
|| $fmri
(
templp_yn
)
}
{
set hp_sigma_vol -1
if
{
$fmri
(
temphp_yn
)
}
{
set hp_sigma_sec
[
expr $fmri
(
paradigm_hp
)
/ 2.0
]
set hp_sigma_vol
[
expr $hp_sigma_sec / $fmri
(
tr
)
]
}
set lp_sigma_vol -1
if
{
$fmri
(
templp_yn
)
}
{
set lp_sigma_sec 2.8
set lp_sigma_vol
[
expr $lp_sigma_sec / $fmri
(
tr
)
]
}
set thecommand
"
$thecommand
-t
$hp
_sigma_vol
$lp
_sigma_vol"
}
fsl:exec
"
$thecommand
"
set INPUT filtered_func_data
#}}}
pack $w.nb -in $w -side top -anchor n -padx 10 -pady 10
pack $w.btns -in $w -side bottom -fill x -padx 10 -pady 10
fsl:exec
"rm -rf prefiltered_func_data*"
#
{{{
load fsf file
#}}}
if
{
$argc > 0
}
{
#
{{{
MELODIC
set thecommand
"
${FSLDIR}
/bin/melodic -i
$
INPUT -o
$
OUTPUT -v --nobet --bgthreshold=
$fmri
(thresh) --tr=
$fmri
(tr)"
set inputname
[
lindex $argv 0
]
set job_duration 20
if
{
[
string first / $inputname
]
!= 0 &&
[
string first ~ $inputname
]
!= 0
}
{
if
{
$fmri
(
dim_yn
)
== 1
}
{
set inputname $
{
PWD
}
/$inputname
set thecommand
"
$thecommand
-d 0"
if
{
$total_volumes > 400
}
{
set job_duration 180
}
}
else
{
set thecommand
"
$thecommand
-d
$fmri
(dim)"
if
{
$fmri
(
dim
)
> 100
}
{
set job_duration 180
}
}
}
if
{
$fmri
(
thresh_yn
)
== 0
}
{
set thecommand
"
$thecommand
--no_mm"
}
else
{
set thecommand
"
$thecommand
--mmthresh=
\"
$fmri
(mmthresh)
\"
"
}
if
{
$fmri
(
varnorm
)
== 0
}
{
set thecommand
"
$thecommand
--vn"
}
if
{
$fmri
(
report
)
== 1
}
{
set thecommand
"
$thecommand
--report"
}
if
{
$fmri
(
ostats
)
== 1
}
{
set thecommand
"
$thecommand
--Ostats"
}
puts $thecommand
if
{
[
string compare
[
file extension $inputname
]
.fsf
]
== 0
}
{
fsl:exec
"
$thecommand
"
-t $job_duration
#}}}
if
{
[
file readable $inputname
]
}
{
puts
"Loading FEAT setup file
$inputname
"
puts
"Done"
feat5:load $w 1 $inputname
}
else
{
if
{
[
file exists report/00index.html
]
}
{
MxPause
"setup file
$inputname
doesn't exist!"
puts
"To view the output report point your web browser at
\n
${OUTPUT}
/report/00index.html
\n\n
"
}
}
}
}
update idletasks
if
{
$dialog
==
"destroy"
}
{
melodic2:destroy $w
}
}
}
#}}}
#}}}
#{{{
me
lodi
c2:destroy
#
{{{
updates needed after the
lo
a
di
ng of settings
# Summary: Destroys melodic dialog box
if
{
$fmri
(
perfsub_yn
)
}
{
proc melodic2:destroy
{
w
}
{
pack $fmri
(
temp
)
.tcmenu -in $fmri
(
temp
)
-after $fmri
(
temp
)
.ps_yn -side top -side left -padx 5
destroy $w
}
}
#}}}
#}}}
#{{{ call GUI and wait
wm withdraw .
feat5:updateanalysis $w
melodic .renam
e
$w.nb compute_siz
e
tkwait window .rename
}
#}}}
if
{
!
[
info exists INGUI
]
}
{
wm withdraw .
melodic .r
tkwait window .r
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment