scil_tractogram_cut_streamlines

usage: __main__.py [-h] (--mask MASK | --labels LABELS)
                   [--label_ids LABEL_IDS LABEL_IDS] [--resample STEP_SIZE]
                   [--min_length MIN_LENGTH] [--no_empty]
                   [--keep_longest | --trim_endpoints]
                   [--one_point_in_roi | --no_point_in_roi]
                   [--compress [COMPRESS_TH]] [-f] [--processes NBR]
                   [--reference REFERENCE] [-v [{DEBUG,INFO,WARNING,ERROR}]]
                   in_tractogram out_tractogram

Cut streamlines using a binary mask or two labels.

--mask: Binary mask. Streamlines outside of the mask will be cut. Three options
are available:

    Default: Will cut the streamlines according to the mask. New streamlines
    may be generated if the mask is disjoint.

    --keep_longest: Will keep the longest segment of the streamline that is
    within the mask. No new streamlines will be generated.

    --trim_endpoints: Will only remove the endpoints of the streamlines that
    are outside the mask. The middle part of the streamline may go
    outside the mask, to compensate for hole in the mask for example. No new
    streamlines will be generated.

--label: Label containing 2 blobs. Streamlines will be cut so they go from the
first label region to the second label region. The two blobs must be disjoint.

    Default: The streamline will start with the first point of the last segment
    of the streamline in the first label and end with the last point of the
    first segment of the streamline in the second label.

    --one_point_in_roi:
        The streamline will start with the last point of the last segment of
        the streamline in the first label and end with the first point in the
        second label. The streamline will be cut at the boundary of the labels.

    --no_point_in_roi:
        The streamline will be cut at the boundary of the labels. No point will
        be kept in the labels.

Both scenarios will erase data_per_point and data_per_streamline. Streamlines
will be extended so they reach the boundary of the mask or the two labels,
therefore won't be equal to the input streamlines.

To generate a label map from a binary mask, you can use the following command:
    scil_labels_from_mask

positional arguments:
  in_tractogram         Input tractogram file.
  out_tractogram        Output tractogram file. Note: data_per_point and data_per_streamline will be discarded.

options:
  -h, --help            show this help message and exit
  --mask MASK           Binary mask.
  --labels LABELS       Label containing 2 blobs.
  --label_ids LABEL_IDS LABEL_IDS
                        List of labels indices to use to cut streamlines (2 values).
  --resample STEP_SIZE  Resample streamlines to a specific step-size in mm [None].
  --min_length MIN_LENGTH
                        Minimum length of streamlines to keep (in mm) [0].
  --no_empty            Do not write file if there is no streamline.
  --compress [COMPRESS_TH]
                        If set, compress the resulting streamline. Value is the maximum
                        compression distance in mm.[0.1]
  -f                    Force overwriting of the output files.
  --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,ERROR}]
                        Produces verbose output depending on the provided level.
                        Default level is warning, default when using -v is info.

Cutting options:
  Options for cutting streamlines with --mask.

  --keep_longest        If set, will keep the longest segment of the streamline that is within the mask.
  --trim_endpoints      If set, will only remove the endpoints of the streamlines that are outside the mask.

Cutting options:
  Options for cutting streamlines with --labels.

  --one_point_in_roi    If set, will keep one point in each label.
  --no_point_in_roi     If set, will not keep any point in the labels.

2.2.2