scil_tractogram_math.py

usage: __main__.py [-h] [--precision NBR_OF_DECIMALS] [--robust]
                   [--no_metadata] [--fake_metadata]
                   [--save_indices OUT_INDEX_FILE] [--save_empty]
                   [--no_bbox_check] [--indent INDENT] [--sort_keys]
                   [--reference REFERENCE] [-v [{DEBUG,INFO,WARNING}]] [-f]
                   OPERATION INPUT_FILES [INPUT_FILES ...] OUTPUT_FILE

Performs an operation on a list of streamline files. The supported
operations are:

difference:  Keep the streamlines from the first file that are not in
                any of the following files.

intersection: Keep the streamlines that are present in all files.

union:        Keep all streamlines while removing duplicates.

concatenate:  Keep all streamlines with duplicates.

lazy_concatenate:  Keep all streamlines with duplicates, never load the whole
                    tractograms in memory. Only works with trk/tck file,
                    metadata will be lost and invalid streamlines are kept.

If a file 'duplicate.trk' have identical streamlines, calling the script using
the difference/intersection/union with a single input will remove these
duplicated streamlines.

To allow a soft match, use the --precision option to increase the allowed
threshold for similarity. A precision of 1 represents 10**(-1), so a
maximum distance of 0.1mm is allowed. If the streamlines are identical, the
default value of 3 (or 0.001mm distance) should work.

If there is a 0.5mm shift, use a precision of 0 (or 1mm distance) and the
--robust option. Should make it work, but slightly slower. Will merge all
streamlines similar when rounded to that precision level.

The metadata (data per point, data per streamline) of the streamlines that
are kept in the output will be preserved. This requires that all input files
share the same type of metadata. If this is not the case, use the option
--no_metadata to strip the metadata from the output. Or --fake_metadata to
initialize dummy metadata in the file missing them.

Formerly: scil_streamlines_math.py

positional arguments:
  OPERATION             The type of operation to be performed on the streamlines. Must
                        be one of the following: difference, intersection, union, concatenate, lazy_concatenate.
  INPUT_FILES           The list of files that contain the streamlines to operate on.
  OUTPUT_FILE           The file where the remaining streamlines are saved.

options:
  -h, --help            show this help message and exit
  --precision NBR_OF_DECIMALS, -p NBR_OF_DECIMALS
                        Precision used to compare streamlines [4].
  --robust, -r          Use version robust to small translation/rotation.
  --no_metadata, -n     Strip the streamline metadata from the output.
  --fake_metadata       Skip the metadata verification, create fake metadata if missing, can lead to unexpected behavior.
  --save_indices OUT_INDEX_FILE, -s OUT_INDEX_FILE
                        Save the streamline indices to the supplied json file.
  --save_empty          If set, we will save all results, even if tractogram if empty.
  --no_bbox_check       Activate to ignore validity of the bounding box during loading / saving of
                        tractograms (ignores the presence of invalid streamlines).
  --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.