@@ -25,6 +25,7 @@ The FileTrees are defined in a simple to type format, where indendation is used
...
@@ -25,6 +25,7 @@ The FileTrees are defined in a simple to type format, where indendation is used
::
::
# Any text following a #-character can be used for comments
parent
parent
file1.txt
file1.txt
child
child
...
@@ -173,6 +174,104 @@ Extensive use of sub-trees can be found in
...
@@ -173,6 +174,104 @@ Extensive use of sub-trees can be found in
`the FileTree of the HCP pre-processed directory structure <https://git.fmrib.ox.ac.uk/fsl/fslpy/blob/master/fsl/utils/filetree/trees/HCP_directory.tree>`_,
`the FileTree of the HCP pre-processed directory structure <https://git.fmrib.ox.ac.uk/fsl/fslpy/blob/master/fsl/utils/filetree/trees/HCP_directory.tree>`_,
which amongst others refers to
which amongst others refers to
`the HCP surface directory format FileTree <https://git.fmrib.ox.ac.uk/fsl/fslpy/blob/master/fsl/utils/filetree/trees/HCP_Surface.tree>`_.
`the HCP surface directory format FileTree <https://git.fmrib.ox.ac.uk/fsl/fslpy/blob/master/fsl/utils/filetree/trees/HCP_Surface.tree>`_.
Example pipeline
----------------
A very simple pipeline to run BET on every subject can start with a simply FileTree like
::
{subject}
T1w.nii.gz
T1w_brain.nii.gz (bet_output)
T1w_brain_mask.nii.gz (bet_mask)
Assuming that the input T1w'salreadyexist,wecanthensimplyrunBETforeverysubjectusing:
.. code-block:: python
from fsl.utils.filetree import FileTree
from fsl.wrappers.bet import bet
tree = FileTree.read(<tree filename>)
variables = tree.get_all_vars('T1w') # extract the set of variables for all existing T1w files
for single_variable_set in variables:
T1w_tree = tree.update(**single_variable_set)
# get retrieves the filenames based on the current set of variables
# make_dir=True ensures that the output directory containing the "bet_output" actually exists