Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
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
fslpy
Commits
0fe6e45b
Commit
0fe6e45b
authored
11 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Updated feat and flirt for new fsl.py structure, and to make them a bit more pep8 compliant.
parent
ea2b88af
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
fsl.py
+0
-1
0 additions, 1 deletion
fsl.py
fsl/tools/feat.py
+74
-35
74 additions, 35 deletions
fsl/tools/feat.py
fsl/tools/flirt.py
+30
-20
30 additions, 20 deletions
fsl/tools/flirt.py
with
104 additions
and
56 deletions
fsl.py
+
0
−
1
View file @
0fe6e45b
...
...
@@ -165,7 +165,6 @@ def buildGUI(fslTool, toolCtx, fslEnvActive):
menuItem
=
fslMenu
.
Append
(
wxId
,
name
)
frame
.
Bind
(
wx
.
EVT_MENU
,
func
,
menuItem
)
toolPanel
.
Layout
()
frame
.
Layout
()
return
frame
...
...
This diff is collapsed.
Click to expand it.
fsl/tools/feat.py
+
74
−
35
View file @
0fe6e45b
...
...
@@ -5,8 +5,6 @@
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
import
os
import
sys
from
collections
import
OrderedDict
...
...
@@ -57,8 +55,8 @@ zRenderingOpts = OrderedDict((
(
'
preset
'
,
'
Use preset Z min/max
'
)))
blobOpts
=
OrderedDict
((
(
'
solid
'
,
'
Solid blobs
'
),
(
'
transparent
'
,
'
Transparent blobs
'
)))
(
'
solid
'
,
'
Solid blobs
'
),
(
'
transparent
'
,
'
Transparent blobs
'
)))
regSearchOpts
=
OrderedDict
((
(
'
none
'
,
'
No search
'
),
...
...
@@ -90,7 +88,9 @@ class Options(props.HasProperties):
progressWatcher
=
props
.
Boolean
(
default
=
True
)
brainBackgroundThreshold
=
props
.
Percentage
(
default
=
10
)
efficNoiseLevel
=
props
.
Percentage
(
default
=
0.66
)
efficTemporalSmoothness
=
props
.
Double
(
default
=
0.34
,
minval
=-
1.0
,
maxval
=
1.0
)
efficTemporalSmoothness
=
props
.
Double
(
default
=
0.34
,
minval
=-
1.0
,
maxval
=
1.0
)
efficZThreshold
=
props
.
Double
(
default
=
5.3
,
minval
=
0.0
)
# misc/higher level
...
...
@@ -99,7 +99,9 @@ class Options(props.HasProperties):
#
# Data options
#
inputData
=
props
.
List
(
minlen
=
1
,
listType
=
props
.
FilePath
(
exists
=
True
,
required
=
True
))
inputData
=
props
.
List
(
minlen
=
1
,
listType
=
props
.
FilePath
(
exists
=
True
,
required
=
True
))
outputDirectory
=
props
.
FilePath
(
isFile
=
False
,
required
=
True
)
totalVolumes
=
props
.
Int
(
minval
=
0
)
deleteVolumes
=
props
.
Int
(
minval
=
0
)
...
...
@@ -108,8 +110,17 @@ class Options(props.HasProperties):
# data/higher level
inputDataType
=
props
.
Choice
(
highLevelInputTypes
)
higherLevelFeatInput
=
props
.
List
(
minlen
=
3
,
listType
=
props
.
FilePath
(
isFile
=
False
,
exists
=
True
,
required
=
lambda
i
:
i
.
inputDataType
==
'
featDirs
'
))
higherLevelCopeInput
=
props
.
List
(
minlen
=
3
,
listType
=
props
.
FilePath
(
exists
=
True
,
required
=
lambda
i
:
i
.
inputDataType
==
'
copeImages
'
))
higherLevelFeatInput
=
props
.
List
(
minlen
=
3
,
listType
=
props
.
FilePath
(
isFile
=
False
,
exists
=
True
,
required
=
lambda
i
:
i
.
inputDataType
==
'
featDirs
'
))
higherLevelCopeInput
=
props
.
List
(
minlen
=
3
,
listType
=
props
.
FilePath
(
exists
=
True
,
required
=
lambda
i
:
i
.
inputDataType
==
'
copeImages
'
))
#
# Pre-stats options
...
...
@@ -119,19 +130,25 @@ class Options(props.HasProperties):
b0Unwarping
=
props
.
Boolean
(
default
=
False
)
# B0 unwarping sub-options - displayed if b0Unwarping is true
b0_fieldmap
=
props
.
FilePath
(
exists
=
True
,
required
=
lambda
i
:
i
.
b0Unwarping
)
b0_fieldmapMag
=
props
.
FilePath
(
exists
=
True
,
required
=
lambda
i
:
i
.
b0Unwarping
)
b0_fieldmap
=
props
.
FilePath
(
exists
=
True
,
required
=
lambda
i
:
i
.
b0Unwarping
)
b0_fieldmapMag
=
props
.
FilePath
(
exists
=
True
,
required
=
lambda
i
:
i
.
b0Unwarping
)
b0_echoSpacing
=
props
.
Double
(
minval
=
0.0
,
default
=
0.7
)
b0_TE
=
props
.
Double
(
minval
=
0.0
,
default
=
35
)
b0_unwarpDir
=
props
.
Choice
((
'
x
'
,
'
-x
'
,
'
y
'
,
'
-y
'
,
'
z
'
,
'
-z
'
))
b0_unwarpDir
=
props
.
Choice
((
'
x
'
,
'
-x
'
,
'
y
'
,
'
-y
'
,
'
z
'
,
'
-z
'
))
b0_signalLossThreshold
=
props
.
Percentage
(
default
=
10
)
sliceTimingCorrection
=
props
.
Choice
(
sliceTimingOpts
)
# slice timing file, displayed if the timing correction
# choice is for a custom order/timing file
sliceTimingFile
=
props
.
FilePath
(
exists
=
True
,
required
=
lambda
i
:
i
.
sliceTimingCorrection
==
'
timingFile
'
)
sliceOrderFile
=
props
.
FilePath
(
exists
=
True
,
required
=
lambda
i
:
i
.
sliceTimingCorrection
==
'
orderFile
'
)
sliceTimingFile
=
props
.
FilePath
(
exists
=
True
,
required
=
lambda
i
:
i
.
sliceTimingCorrection
==
'
timingFile
'
)
sliceOrderFile
=
props
.
FilePath
(
exists
=
True
,
required
=
lambda
i
:
i
.
sliceTimingCorrection
==
'
orderFile
'
)
brainExtraction
=
props
.
Boolean
(
default
=
True
)
smoothingFWHM
=
props
.
Double
(
minval
=
0.0
,
default
=
5.0
)
...
...
@@ -161,7 +178,8 @@ class Options(props.HasProperties):
# Post-stats options
#
preThresholdMask
=
props
.
FilePath
(
exists
=
True
)
thresholding
=
props
.
Choice
((
'
None
'
,
'
Uncorrected
'
,
'
Voxel
'
,
'
Cluster
'
))
thresholding
=
props
.
Choice
((
'
None
'
,
'
Uncorrected
'
,
'
Voxel
'
,
'
Cluster
'
))
# Thresholding sub-options
# displayed if thresholding is not None
...
...
@@ -328,7 +346,7 @@ dataView = props.VGroup(
label
=
'
Data
'
,
children
=
(
props
.
VGroup
(
visibleWhen
=
lambda
i
:
i
.
analysisType
==
'
firstLevel
'
,
visibleWhen
=
lambda
i
:
i
.
analysisType
==
'
firstLevel
'
,
children
=
(
'
inputData
'
,
'
outputDirectory
'
,
...
...
@@ -337,11 +355,15 @@ dataView = props.VGroup(
'
TR
'
,
'
highpassFilterCutoff
'
)),
props
.
VGroup
(
visibleWhen
=
lambda
i
:
i
.
analysisType
==
'
highLevel
'
,
visibleWhen
=
lambda
i
:
i
.
analysisType
==
'
highLevel
'
,
children
=
(
'
inputDataType
'
,
props
.
Widget
(
'
higherLevelFeatInput
'
,
visibleWhen
=
lambda
i
:
i
.
inputDataType
==
'
featDirs
'
),
props
.
Widget
(
'
higherLevelCopeInput
'
,
visibleWhen
=
lambda
i
:
i
.
inputDataType
==
'
copeImages
'
),
props
.
Widget
(
'
higherLevelFeatInput
'
,
visibleWhen
=
lambda
i
:
i
.
inputDataType
==
'
featDirs
'
),
props
.
Widget
(
'
higherLevelCopeInput
'
,
visibleWhen
=
lambda
i
:
i
.
inputDataType
==
'
copeImages
'
),
'
outputDirectory
'
))))
prestatsView
=
props
.
VGroup
(
...
...
@@ -363,8 +385,12 @@ prestatsView = props.VGroup(
'
b0_unwarpDir
'
,
'
b0_signalLossThreshold
'
)),
'
sliceTimingCorrection
'
,
props
.
Widget
(
'
sliceTimingFile
'
,
visibleWhen
=
lambda
i
:
i
.
sliceTimingCorrection
==
'
timingFile
'
),
props
.
Widget
(
'
sliceOrderFile
'
,
visibleWhen
=
lambda
i
:
i
.
sliceTimingCorrection
==
'
orderFile
'
),
props
.
Widget
(
'
sliceTimingFile
'
,
visibleWhen
=
lambda
i
:
i
.
sliceTimingCorrection
==
'
timingFile
'
),
props
.
Widget
(
'
sliceOrderFile
'
,
visibleWhen
=
lambda
i
:
i
.
sliceTimingCorrection
==
'
orderFile
'
),
'
brainExtraction
'
,
'
smoothingFWHM
'
,
'
intensityNorm
'
,
...
...
@@ -374,7 +400,7 @@ prestatsView = props.VGroup(
children
=
(
'
perfusionSubtraction
'
,
props
.
Widget
(
'
perfusionOption
'
,
visibleWhen
=
lambda
i
:
i
.
perfusionSubtraction
))),
visibleWhen
=
lambda
i
:
i
.
perfusionSubtraction
))),
'
temporalHighpass
'
,
'
melodic
'
))
...
...
@@ -401,17 +427,27 @@ postStatsView = props.VGroup(
border
=
True
,
children
=
(
'
thresholding
'
,
props
.
Widget
(
'
pThreshold
'
,
visibleWhen
=
lambda
i
:
i
.
thresholding
!=
'
None
'
),
props
.
Widget
(
'
zThreshold
'
,
visibleWhen
=
lambda
i
:
i
.
thresholding
==
'
Cluster
'
),
props
.
Button
(
'
Contrast masking
'
,
visibleWhen
=
lambda
i
:
i
.
thresholding
!=
'
None
'
))),
props
.
Widget
(
'
pThreshold
'
,
visibleWhen
=
lambda
i
:
i
.
thresholding
!=
'
None
'
),
props
.
Widget
(
'
zThreshold
'
,
visibleWhen
=
lambda
i
:
i
.
thresholding
==
'
Cluster
'
),
props
.
Button
(
'
Contrast masking
'
,
visibleWhen
=
lambda
i
:
i
.
thresholding
!=
'
None
'
))),
props
.
VGroup
(
label
=
'
Rendering
'
,
border
=
True
,
visibleWhen
=
lambda
i
:
i
.
thresholding
!=
'
None
'
,
children
=
(
'
renderZMinMax
'
,
props
.
Widget
(
'
renderZMin
'
,
visibleWhen
=
lambda
i
:
i
.
renderZMinMax
==
'
preset
'
),
props
.
Widget
(
'
renderZMax
'
,
visibleWhen
=
lambda
i
:
i
.
renderZMinMax
==
'
preset
'
),
props
.
Widget
(
'
renderZMin
'
,
visibleWhen
=
lambda
i
:
i
.
renderZMinMax
==
'
preset
'
),
props
.
Widget
(
'
renderZMax
'
,
visibleWhen
=
lambda
i
:
i
.
renderZMinMax
==
'
preset
'
),
'
blobTypes
'
))))
regView
=
props
.
VGroup
(
...
...
@@ -422,28 +458,32 @@ regView = props.VGroup(
props
.
HGroup
(
label
=
'
Functional -> Expanded functional
'
,
border
=
True
,
visibleWhen
=
lambda
i
:
i
.
expandedFunctionalImage
is
not
None
,
visibleWhen
=
lambda
i
:
i
.
expandedFunctionalImage
is
not
None
,
children
=
(
'
functionalSearch
'
,
'
functionalDof
'
)),
'
mainStructuralImage
'
,
props
.
HGroup
(
label
=
'
Functional -> Structural
'
,
border
=
True
,
visibleWhen
=
lambda
i
:
i
.
mainStructuralImage
is
not
None
,
visibleWhen
=
lambda
i
:
i
.
mainStructuralImage
is
not
None
,
children
=
(
'
structuralSearch
'
,
'
structuralDof
'
)),
'
standardSpaceImage
'
,
props
.
VGroup
(
label
=
'
Structural -> Standard
'
,
border
=
True
,
visibleWhen
=
lambda
i
:
i
.
standardSpaceImage
is
not
None
,
visibleWhen
=
lambda
i
:
i
.
standardSpaceImage
is
not
None
,
children
=
(
props
.
HGroup
((
'
standardSearch
'
,
'
standardDof
'
)),
props
.
HGroup
((
'
nonLinearReg
'
,
props
.
Widget
(
'
warpResolution
'
,
visibleWhen
=
lambda
i
:
i
.
nonLinearReg
)))))))
props
.
HGroup
((
'
nonLinearReg
'
,
props
.
Widget
(
'
warpResolution
'
,
visibleWhen
=
lambda
i
:
i
.
nonLinearReg
)))))))
featView
=
props
.
VGroup
((
featView
=
props
.
VGroup
((
'
analysisType
'
,
props
.
Widget
(
'
analysisStages
'
,
enabledWhen
=
lambda
i
:
i
.
analysisType
==
'
firstLevel
'
),
props
.
Widget
(
'
analysisStages
'
,
enabledWhen
=
lambda
i
:
i
.
analysisType
==
'
firstLevel
'
),
props
.
NotebookGroup
((
miscView
,
dataView
,
...
...
@@ -462,6 +502,5 @@ def interface(parent, featOpts):
FSL_TOOLNAME
=
'
FEAT
'
FSL_HELPPAGE
=
'
feat
'
FSL_
OPTIONS
=
Options
FSL_
CONTEXT
=
lambda
args
:
Options
()
FSL_INTERFACE
=
interface
FSL_RUNTOOL
=
None
This diff is collapsed.
Click to expand it.
fsl/tools/flirt.py
+
30
−
20
View file @
0fe6e45b
...
...
@@ -5,9 +5,6 @@
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
import
os
import
sys
from
collections
import
OrderedDict
import
fsl.props
as
props
...
...
@@ -52,13 +49,18 @@ sincWindowOpts = OrderedDict((
(
'
blackman
'
,
'
Blackman
'
)))
def
inSingleMode
(
opts
):
return
opts
.
flirtMode
==
'
single
'
def
inMultipleMode
(
opts
):
return
opts
.
flirtMode
==
'
multiple
'
class
Options
(
props
.
HasProperties
):
flirtMode
=
props
.
Choice
(
flirtModes
)
inputImage
=
props
.
FilePath
(
exists
=
True
,
required
=
lambda
i
:
i
.
flirtMode
==
'
single
'
)
loResImage
=
props
.
FilePath
(
exists
=
True
,
required
=
lambda
i
:
i
.
flirtMode
==
'
m
ultiple
'
)
hiResImage
=
props
.
FilePath
(
exists
=
True
,
required
=
lambda
i
:
i
.
flirtMode
==
'
m
ultiple
'
)
inputImage
=
props
.
FilePath
(
exists
=
True
,
required
=
inSingleMode
)
loResImage
=
props
.
FilePath
(
exists
=
True
,
required
=
inM
ultiple
Mode
)
hiResImage
=
props
.
FilePath
(
exists
=
True
,
required
=
inM
ultiple
Mode
)
refImage
=
props
.
FilePath
(
exists
=
True
,
required
=
True
)
outputImage
=
props
.
FilePath
(
required
=
True
)
...
...
@@ -100,21 +102,29 @@ searchOptions = props.VGroup(
label
=
'
Search
'
,
children
=
(
'
searchMode
'
,
props
.
HGroup
((
'
searchAngleXMin
'
,
'
searchAngleXMax
'
),
visibleWhen
=
lambda
i
:
i
.
searchMode
!=
'
nosearch
'
),
props
.
HGroup
((
'
searchAngleYMin
'
,
'
searchAngleYMax
'
),
visibleWhen
=
lambda
i
:
i
.
searchMode
!=
'
nosearch
'
),
props
.
HGroup
((
'
searchAngleZMin
'
,
'
searchAngleZMax
'
),
visibleWhen
=
lambda
i
:
i
.
searchMode
!=
'
nosearch
'
)))
props
.
HGroup
((
'
searchAngleXMin
'
,
'
searchAngleXMax
'
),
visibleWhen
=
lambda
i
:
i
.
searchMode
!=
'
nosearch
'
),
props
.
HGroup
((
'
searchAngleYMin
'
,
'
searchAngleYMax
'
),
visibleWhen
=
lambda
i
:
i
.
searchMode
!=
'
nosearch
'
),
props
.
HGroup
((
'
searchAngleZMin
'
,
'
searchAngleZMax
'
),
visibleWhen
=
lambda
i
:
i
.
searchMode
!=
'
nosearch
'
)))
costFuncOptions
=
props
.
VGroup
(
label
=
'
Cost Function
'
,
children
=
(
'
costFunction
'
,
props
.
Widget
(
'
costHistBins
'
,
visibleWhen
=
lambda
i
:
i
.
costFunction
in
[
'
correlation
'
,
'
mutualinfo
'
,
'
normmutualinfo
'
])))
props
.
Widget
(
'
costHistBins
'
,
visibleWhen
=
lambda
i
:
i
.
costFunction
in
[
'
correlation
'
,
'
mutualinfo
'
,
'
normmutualinfo
'
])))
interpOptions
=
props
.
VGroup
(
label
=
'
Interpolation
'
,
children
=
(
'
interpolation
'
,
props
.
VGroup
((
'
sincWindow
'
,
'
sincWindowWidth
'
),
visibleWhen
=
lambda
i
:
i
.
interpolation
==
'
sinc
'
)))
props
.
VGroup
((
'
sincWindow
'
,
'
sincWindowWidth
'
),
visibleWhen
=
lambda
i
:
i
.
interpolation
==
'
sinc
'
)))
weightVolOptions
=
props
.
VGroup
(
label
=
'
Weighting Volumes
'
,
...
...
@@ -125,12 +135,12 @@ weightVolOptions = props.VGroup(
flirtView
=
props
.
VGroup
((
'
flirtMode
'
,
'
refImage
'
,
props
.
Widget
(
'
inputImage
'
,
visibleWhen
=
lambda
i
:
i
.
flirtMode
==
'
single
'
),
props
.
Widget
(
'
inToRefMode
'
,
visibleWhen
=
lambda
i
:
i
.
flirtMode
==
'
single
'
),
props
.
Widget
(
'
hiResImage
'
,
visibleWhen
=
lambda
i
:
i
.
flirtMode
==
'
m
ultiple
'
),
props
.
Widget
(
'
hiToRefMode
'
,
visibleWhen
=
lambda
i
:
i
.
flirtMode
==
'
m
ultiple
'
),
props
.
Widget
(
'
loResImage
'
,
visibleWhen
=
lambda
i
:
i
.
flirtMode
==
'
m
ultiple
'
),
props
.
Widget
(
'
loToHiMode
'
,
visibleWhen
=
lambda
i
:
i
.
flirtMode
==
'
m
ultiple
'
),
props
.
Widget
(
'
inputImage
'
,
visibleWhen
=
inSingleMode
),
props
.
Widget
(
'
inToRefMode
'
,
visibleWhen
=
inSingleMode
),
props
.
Widget
(
'
hiResImage
'
,
visibleWhen
=
inM
ultiple
Mode
),
props
.
Widget
(
'
hiToRefMode
'
,
visibleWhen
=
inM
ultiple
Mode
),
props
.
Widget
(
'
loResImage
'
,
visibleWhen
=
inM
ultiple
Mode
),
props
.
Widget
(
'
loToHiMode
'
,
visibleWhen
=
inM
ultiple
Mode
),
'
outputImage
'
,
'
sndyImages
'
,
props
.
NotebookGroup
(
label
=
'
Advanced Options
'
,
...
...
@@ -140,18 +150,18 @@ flirtView = props.VGroup((
interpOptions
,
weightVolOptions
))))
def
runFlirt
(
parent
,
opts
):
pass
def
interface
(
parent
,
opts
):
return
props
.
buildGUI
(
parent
,
opts
,
flirtView
,
labels
,
tooltips
)
FSL_TOOLNAME
=
'
FLIRT
'
FSL_HELPPAGE
=
'
flirt
'
FSL_
OPTIONS
=
Options
FSL_
CONTEXT
=
lambda
args
:
Options
()
FSL_INTERFACE
=
interface
FSL_
RUNTOOL
=
runFlirt
FSL_
ACTIONS
=
[(
'
Run FLIRT
'
,
runFlirt
)]
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