usage: __main__.py [-h] [--minL MINL] [--maxL MAXL] [--angle ANGLE]
[--csf_bin CSF_BIN] [--dilate_ctx value]
[--save_intermediate_tractograms] [--save_volumes]
[--save_counts] [--save_rejected] [--no_empty]
[--indent INDENT] [--sort_keys] [--processes NBR]
[--reference REFERENCE] [-v [{DEBUG,INFO,WARNING}]] [-f]
in_tractogram in_wmparc out_path
This script filters streamlines in a tractogram according to their geometrical
properties (i.e. limiting their length and looping angle) and their anatomical
ending properties (i.e. the anatomical tissue or region their endpoints lie
in).
See also:
- scil_tractogram_detect_loops.py
- scil_tractogram_filter_by_length.py
- scil_tractogram_filter_by_orientation.py
- scil_tractogram_filter_by_roi.py
- scil_labels_dilate.py
(This script is a combination of all these scripts, in one step).
The filtering is performed sequentially in four steps, each step processing the
data on the output of the previous step:
Step 1 - Remove streamlines below the minimum length and above the
maximum length. These thresholds must be set with the ``--minL``
and ``--maxL`` options.
Step 2 - Ensure that no streamlines end in the cerebrospinal fluid
according to the provided parcellation. A binary mask can be used
alternatively through the ``--csf_bin`` option.
Step 3 - Ensure that no streamlines end in white matter by ensuring that
they reach the cortical regions according to the provided
parcellation. The cortical regions of the parcellation can be
dilated using the ``--ctx_dilation_radius``.
Step 4 - Remove streamlines if they make a loop with an angle above a
certain threshold. It's possible to change this angle with the
``--angle`` option.
Length and loop-based filtering (steps 1 and 2) will not have practical effects
if no specific thresholds are provided (but will be still executed), since
default values are 0 for the minimum allowed length and infinite for the
maximum allowed length and angle.
The anatomical region endings filtering requires a parcellation or label image
file including the cerebrospinal fluid and gray matter (cortical) regions
according to the Desikan-Killiany atlas. Intermediate tractograms (results of
each step and outliers) and volumes can be saved throughout the process.
Usage examples:
- Filter out "bad streamlines" using length, looping angle and anatomical
ending region (must end in the gray matter).
>>> scil_tractogram_filter_by_anatomy.py tractogram.trk wmparc.nii.gz
path/to/output/directory --minL 20 --maxL 200 --angle 300
- Filter out "bad streamline" using only anatomical ending region, with WM
dilation and provided CSF mask.
>>> scil_tractogram_filter_by_anatomy.py tractogram.trk wmparc.nii.gz
path/to/output/directory --csf_bin csf_bin.nii.gz --ctx_dilation_radius 2
Formerly: scil_filter_streamlines_anatomically.py
NOTE: As of version 2.0.0, the dilation of the cortical mask has changed; from
an in-house process to scipy's dilation. Results may differ from previous
versions.
----------------------------------------------------------------------------
References:
[1] Jörgens, D., Descoteaux, M., Moreno, R., 2021. Challenges for
tractogram filtering. In: Özarslan, E., Schultz, T., Zhang, E., Fuster,
A. (Eds.), Anisotropy Across Fields and Scales. Springer. Mathematics
and Visualization.
[2] Legarreta, J., Petit, L., Rheault, F., Theaud, G., Lemaire, C.,
Descoteaux, M., Jodoin, P.M. Filtering in tractography using
autoencoders (FINTA). Medical Image Analysis. 2021
----------------------------------------------------------------------------
positional arguments:
in_tractogram Path of the input tractogram file.
in_wmparc Path of the white matter parcellation atlas (.nii or .nii.gz)
out_path Path to the output files.
options:
-h, --help show this help message and exit
--minL MINL Minimum length of streamlines, in mm. [0.0]
--maxL MAXL Maximum length of streamlines, in mm. [inf]
--angle ANGLE Maximum looping (or turning) angle of a streamline,
in degrees. [inf]
--csf_bin CSF_BIN Allow CSF endings filtering with this binary
mask instead of using the atlas (.nii or .nii.gz)
--dilate_ctx value If set, dilate the cortical labels. Value is the dilation
radius, in voxels (an integer > 0)
--save_intermediate_tractograms
Save accepted and discarded streamlines after each step.
--save_volumes Save volumetric images (e.g. binarised label
images, etc) in the filtering process.
--save_counts Save the streamline counts to a file (.json)
--save_rejected Save rejected streamlines to output tractogram.
--no_empty Do not write file if there is no streamlines.
--processes NBR Number of sub-processes to start.
Default: [1]
--reference REFERENCE
Reference anatomy for tck/vtk/fib/dpy file
support (.nii or .nii.gz).
-v [{DEBUG,INFO,WARNING}]
Produces verbose output depending on the provided level.
Default level is warning, default when using -v is info.
-f Force overwriting of the output files.
Json options:
--indent INDENT Indent for json pretty print.
--sort_keys Sort keys in output json.
Scilpy version: 2.0.2