scil_tractogram_assign_custom_color.py

usage: __main__.py [-h] [--out_colorbar OUT_COLORBAR] [--show_colorbar]
                   [--horizontal_cbar]
                   (--use_dps DPS_KEY | --use_dpp DPP_KEY | --load_dps DPS_FILE | --load_dpp DPP_FILE | --from_anatomy FILE | --along_profile | --local_angle)
                   [--colormap COLORMAP] [--clip_outliers]
                   [--min_range MIN_RANGE] [--max_range MAX_RANGE]
                   [--min_cmap MIN_CMAP] [--max_cmap MAX_CMAP] [--log]
                   [--LUT FILE] [--reference REFERENCE]
                   [-v [{DEBUG,INFO,WARNING}]] [-f]
                   in_tractogram out_tractogram

The script uses scalars from an anatomy, data_per_point or data_per_streamline
(e.g. commit_weights) to visualize them on the streamlines.
Saves the RGB values in the data_per_point 'color' with 3 values per point:
(color_x, color_y, color_z).

If called with .tck, the output will always be .trk, because data_per_point has
no equivalent in tck file.

If used with a visualization software like MI-Brain
(https://github.com/imeka/mi-brain), the 'color' dps is applied by default at
loading time.

COLORING METHOD
This script maps the raw values from these sources to RGB using a colormap.
    --use_dpp: The data from each point is converted to a color.
    --use_dps: The same color is applied to all points of the streamline.
    --from_anatomy: The voxel's color is used for the points of the streamlines
    crossing it. See also scil_tractogram_project_map_to_streamlines.py. You
    can have more options to project maps to dpp, and then use --use_dpp here.
    --along_profile: The data used here is each point's position in the
    streamline. To have nice results, you should first uniformize head/tail.
    See scil_tractogram_uniformize_endpoints.py.
    --local_angle.

COLORING OPTIONS
A minimum and a maximum range can be provided to clip values. If the range of
values is too large for intuitive visualization, a log transform can be
applied.

If the data provided from --use_dps, --use_dpp and --from_anatomy are integer
labels, they can be mapped using a LookUp Table (--LUT).
The file provided as a LUT should be either .txt or .npy and if the size is
N=20, then the data provided should be between 1-20.

A custom colormap can be provided using --colormap. It should be a string
containing a colormap name OR multiple Matplotlib named colors separated by -.
The colormap used for mapping values to colors can be saved to a png/jpg image
using the --out_colorbar option.

See also: scil_tractogram_assign_uniform_color.py, for simplified options.

Formerly: scil_assign_custom_color_to_tractogram.py

positional arguments:
  in_tractogram         Input tractogram (.trk or .tck).
  out_tractogram        Output tractogram (.trk or .tck).

options:
  -h, --help            show this help message and exit
  --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.

Colorbar options:
  --out_colorbar OUT_COLORBAR
                        Optional output colorbar (.png, .jpg or any format
                        supported by matplotlib).
  --show_colorbar       Will show the colorbar. Must be used with --out_colorbar
                        to be effective.
  --horizontal_cbar     Draw horizontal colorbar (vertical by default).

Coloring method:
  --use_dps DPS_KEY     Use the data_per_streamline (scalar) for coloring.
  --use_dpp DPP_KEY     Use the data_per_point (scalar) for coloring.
  --load_dps DPS_FILE   Load data per streamline (scalar) for coloring
  --load_dpp DPP_FILE   Load data per point (scalar) for coloring
  --from_anatomy FILE   Use the voxel data for coloring,
                        linear scaling from minmax.
  --along_profile       Color streamlines according to each point positionalong its length.
  --local_angle         Color streamlines according to the angle between each segment (in degree).
                        Angles at first and last points are set to 0.

Coloring options:
  --colormap COLORMAP   Select the colormap for colored trk (dps/dpp) [jet].
                        Use two Matplotlib named color separeted by a - to create your own colormap.
  --clip_outliers       If set, we will clip the outliers (first and last 5% quantile). Strongly suggested if your data comes from COMMIT!
  --min_range MIN_RANGE
                        Set the minimum value when using dps/dpp/anatomy.
  --max_range MAX_RANGE
                        Set the maximum value when using dps/dpp/anatomy.
  --min_cmap MIN_CMAP   Set the minimum value of the colormap.
  --max_cmap MAX_CMAP   Set the maximum value of the colormap.
  --log                 Apply a base 10 logarithm for colored trk (dps/dpp).
  --LUT FILE            If the dps/dpp or anatomy contain integer labels, the value will be substituted.
                        If the LUT has 20 elements, integers from 1-20 in the data will be
                        replaced by the value in the file (.npy or .txt)