scil_bundle_diameter

usage: __main__.py [-h] [--fitting_func {lin_up,lin_down,exp,inv,log}]
                   [--show_rendering | --save_rendering out_dir] [--wireframe]
                   [--error_coloring] [--width WIDTH] [--opacity OPACITY]
                   [--win_dims WIDTH HEIGHT] [--background R G B]
                   [--reference REFERENCE] [--indent INDENT] [--sort_keys]
                   [-v [{DEBUG,INFO,WARNING,ERROR}]] [-f]
                   in_bundles [in_bundles ...] in_labels [in_labels ...]

Script to estimate the diameter of bundle(s) along their length.
See also scil_bundle_shape_measures, which prints a quick estimate of
the diameter (volume / length). The computation here is more complex and done
for each section of the bundle.

The script expects:
- bundles with coherent endpoints from scil_bundle_uniformize_endpoints
- labels maps of the bundle's sections, with around 5-50 points,
  from scil_bundle_label_map
    - <5 is not enough, high risk of bad fit
    - >50 is too much, high risk of bad fit
- bundles that are close to a tube
    - without major fanning, in a single axis
    - or if fanning is in 2 directions (uniform dispersion), leads to a good
      approximation

Fitting func
------------
Choices are:
- None: Default, all points are weighted equally no matter their
        (normalized 0-1) distance to the barycenter.
- lin_up: Points are weighted using their distance to the barycenter
        (linear, x). Farther = increased weight. Bigger envelope.
- lin_down: Points are weighted using their distance to the barycenter
        (linear, 1-x). Farther = decreased weight. Smaller envelope.
- exp: Points are weighted using their distance to the barycenter
        (exponential, e^x). Farther = decreased weight. Smaller envelope.
- inv: Points are weighted using their distance to the barycenter
        (inverse, 1/x). Farther = decreased weight. Much smaller envelope.
- log: Points are weighted using their distance to the barycenter
        (logarithmic, ln x+1). Farther = increased weight. Bigger envelope.

The scripts prints a JSON file with mean/std. This is compatible with our
tractometry scripts.
WARNING: STD is in fact an ERROR measure from the fit and NOT an STD.

Since the estimation and fit quality is not always intuitive for some bundles
and the tube with varying diameter is not easy to color/visualize,
the script comes with its own VTK rendering to allow exploration of the data.
(optional).

positional arguments:
  in_bundles            List of tractography files.
  in_labels             List of labels maps that match the bundles, with each section as a different label.

options:
  -h, --help            show this help message and exit
  --fitting_func {lin_up,lin_down,exp,inv,log}
                        Function to weigh points using their distance.
                        -  lin_up: linear
                        -  lin_down: inversely linear
                        -  exp: exponential
                        -  inv: inversely exponential
                        -  log: logarithmic
                        [Default: None]
  --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.
  -f                    Force overwriting of the output files.

Visualization options:
  --show_rendering      Display VTK window (optional).
                        (Note. This option is not verified by tests. If you encounter any bug,
                        please report it to our team.)
  --save_rendering out_dir
                        Save VTK render in the specified folder (optional)
  --wireframe           Use wireframe for the tube rendering.
  --error_coloring      Use the fitting error to color the tube.
  --width WIDTH         Width of tubes or lines representing streamlines
                        [Default: 0.2]
  --opacity OPACITY     Opacity for the streamlines rendered with the tube.
                        [Default: 0.2]
  --win_dims WIDTH HEIGHT
                        The dimensions for the vtk window. [(1920, 1080)]
  --background R G B    RBG values [0, 255] of the color of the background.
                        [Default: [1, 1, 1]]

Json options:
  --indent INDENT       Indent for json pretty print.
  --sort_keys           Sort keys in output json.

2.2.2