Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Michiel Cottaar
fslpy
Commits
967cc62e
Commit
967cc62e
authored
4 years ago
by
Evan Edmond
Browse files
Options
Downloads
Patches
Plain Diff
DOC: filetree docs [skip-ci]
parent
9db1e57e
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
fsl/utils/filetree/__init__.py
+37
-1
37 additions, 1 deletion
fsl/utils/filetree/__init__.py
with
37 additions
and
1 deletion
fsl/utils/filetree/__init__.py
+
37
−
1
View file @
967cc62e
...
...
@@ -177,7 +177,7 @@ which amongst others refers to
Example pipeline
----------------
A very simple pipeline to run BET on every subject can start with a
simply
FileTree like
A very simple pipeline to run BET on every subject can start with a FileTree like
::
{subject}
...
...
@@ -200,6 +200,12 @@ Assuming that the input T1w's already exist, we can then simply run BET for ever
# make_dir=True ensures that the output directory containing the
"
bet_output
"
actually exists
bet(input=T1w_tree.get(
'
T1w
'
), output=T1w_tree.get(
'
bet_output
'
, make_dir=True), mask=True)
Useful tips
-----------
Changing directory structure
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If later on in our input files change, because for some subjects we added a second session, we could keep our script
and simply update the FileTree:
::
...
...
@@ -246,6 +252,9 @@ even though we don't explicitly reference these in the script.
The
reason
for
this
is
that
each
directory
and
filename
template
must
have
a
unique
short
name
and
in
this
case
the
default
short
names
(
respectively
,
"
{subject}
"
and
"
[ses-{session}]
"
)
would
not
have
been
unique
.
Output
"
basenames
"
^^^^^^^^^^^^^^^^^^
Some tools like FSL
'
s
FAST
produce
many
output
files
.
Rather
than
entering
all
of
these
files
in
our
FileTree
by
hand
you
can
include
them
all
at
once
by
including
`Sub-trees`
_
:
...
...
@@ -276,6 +285,33 @@ Within the script we can generate the fast output by running
The output files will be available as `T1w_tree.get(
'
segment/<variable name>
'
)`, where `<variable name>` is one
of the short variable names defined in the
`FAST FileTree <https://git.fmrib.ox.ac.uk/fsl/fslpy/blob/master/fsl/utils/filetree/trees/fast.tree>`_.
Running a pipeline on a subset of participants/sessions/runs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Suppose you want to run your pipeline on a subset of your data while testing.
You may want to do this if your data has a a hierarchy of variables (e.g. participant, session, run) as in the example below.
::
sub-001
ses-01
sub-001_ses-01_run-1.feat
sub-001_ses-01_run-2.feat
ses-02
sub-{participant}_ses-{session}_run-{run}.feat (feat_dir)
...
sub
-
002
sub
-
003
...
You can update the FileTree with one or more variables before calling `get_all_trees` as follows:
.. code-block:: python
for t in tree.update(participant=(
'
001
'
,
'
002
'
), run=(
"
1
"
)).get_all_trees(
"
feat_dir
"
):
my_pipeline(t)
"""
__author__
=
'
Michiel Cottaar <Michiel.Cottaar@ndcn.ox.ac.uk>
'
...
...
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