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
7f4202fa
Commit
7f4202fa
authored
1 year ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
MNT,ENH: Rename cluster module so I can mock things within. New smoothest
wrapper function
parent
10718588
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fsl/wrappers/__init__.py
+2
-1
2 additions, 1 deletion
fsl/wrappers/__init__.py
fsl/wrappers/cluster_commands.py
+56
-0
56 additions, 0 deletions
fsl/wrappers/cluster_commands.py
with
58 additions
and
1 deletion
fsl/wrappers/__init__.py
+
2
−
1
View file @
7f4202fa
...
@@ -101,7 +101,8 @@ from fsl.wrappers.wrapperutils import (LOAD,
...
@@ -101,7 +101,8 @@ from fsl.wrappers.wrapperutils import (LOAD,
fslwrapper
,
fslwrapper
,
funcwrapper
)
funcwrapper
)
from
fsl.wrappers
import
(
tbss
,)
from
fsl.wrappers
import
(
tbss
,)
from
fsl.wrappers.cluster
import
(
cluster
,)
from
fsl.wrappers.cluster_commands
import
(
cluster
,
smoothest
)
from
fsl.wrappers.bet
import
(
bet
,
from
fsl.wrappers.bet
import
(
bet
,
robustfov
)
robustfov
)
from
fsl.wrappers.eddy
import
(
eddy
,
from
fsl.wrappers.eddy
import
(
eddy
,
...
...
This diff is collapsed.
Click to expand it.
fsl/wrappers/cluster.py
→
fsl/wrappers/cluster
_commands
.py
+
56
−
0
View file @
7f4202fa
...
@@ -66,3 +66,59 @@ def _cluster(infile, thresh, **kwargs):
...
@@ -66,3 +66,59 @@ def _cluster(infile, thresh, **kwargs):
cmd
+=
wutils
.
applyArgStyle
(
'
--=
'
,
valmap
=
valmap
,
**
kwargs
)
cmd
+=
wutils
.
applyArgStyle
(
'
--=
'
,
valmap
=
valmap
,
**
kwargs
)
return
cmd
return
cmd
def
smoothest
(
inimg
=
None
,
**
kwargs
):
"""
Wrapper for the ``smoothest`` command.
The residual or zstatistic image may be passed as the first positional
argument (``inimg``) - its type is inferred from the image file name if
possible. If this is not possible (e.g. non-standard file names or
in-memory images), you must specify residual images via ``res``, or
zstatistic images via ``zstat``.
Returns a dictionary containing the parameters estimated by ``smoothest``,
e.g.::
{
'
DLH
'
: 1.25903,
'
VOLUME
'
: 239991,
'
RESELS
'
: 3.69574,
'
FWHMvoxel
'
: [1.57816, 1.64219, 1.42603],
'
FWHMmm
'
: [3.15631, 3.28437, 2.85206]
}
"""
result
=
_smoothest
(
**
kwargs
)
result
=
result
.
stdout
[
0
]
result
=
result
.
strip
().
split
(
'
\n
'
)[
-
5
:]
values
=
{}
for
line
in
result
:
key
,
vals
=
line
.
split
(
maxsplit
=
1
)
vals
=
[
float
(
v
)
for
v
in
vals
.
split
()]
if
len
(
vals
)
==
1
:
vals
=
vals
[
0
]
values
[
key
]
=
vals
return
values
@wutils.fileOrImage
(
'
inimg
'
,
'
r
'
,
'
res
'
,
'
z
'
,
'
zstat
'
,
'
m
'
,
'
mask
'
)
@wutils.fslwrapper
def
_smoothest
(
inimg
=
None
,
**
kwargs
):
"""
Actual wrapper for the ``smoothest`` command.
"""
if
inimg
is
not
None
:
if
'
res4d
'
in
inimg
:
kwargs
[
'
res
'
]
=
inimg
elif
'
zstat
'
in
inimg
:
kwargs
[
'
zstat
'
]
=
inimg
else
:
raise
RuntimeError
(
'
Cannot infer type of input
'
f
'
image
{
inimg
.
name
}
'
)
valmap
=
{
'
V
'
:
wutils
.
SHOW_IF_TRUE
,
'
verbose
'
:
wutils
.
SHOW_IF_TRUE
,
}
return
[
'
smoothest
'
]
+
wutils
.
applyArgStyle
(
'
--=
'
,
valmap
=
valmap
,
**
kwargs
)
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