CorpusCallosum: cc_visualization.py

Visualize corpus callosum from template files.

usage: cc_visualization.py [-h] --template_dir TEMPLATE_DIR --output_dir
                           OUTPUT_DIR [--resolution RESOLUTION]
                           [--smoothing_window SMOOTHING_WINDOW]
                           [--colormap {red_to_blue,blue_to_red,red_to_yellow,yellow_to_red}]
                           [--color_range MIN MAX] [--legend LEGEND] [--twoD]
                           [-v]

Named Arguments

--template_dir

Path to a template directory containing per-slice files named thickness_values_<idx>.txt, and optionally contour_<idx>.txt and thickness_measurement_points_<idx>.txt. If contour_<idx>.txt and thickness_measurement_points_<idx>.txt are not provided, uses fsaverage template.

--output_dir

Directory for output files. Writes: cc_mesh.html - Interactive 3D mesh visualization (HTML file) midslice_2d.png - 2D midslice visualization of the corpus callosum cc_mesh.vtk - VTK mesh file format cc_mesh.fssurf - FreeSurfer surface file cc_mesh_overlay.curv - FreeSurfer curvature overlay file cc_mesh_snap.png - Screenshot/snapshot of the 3D mesh (requires whippersnappy>=1.3.1)

--resolution

Resolution in mm for the mesh.

Default: 1.0

--smoothing_window

Window size for smoothing the contour.

Default: 5

--colormap

Possible choices: red_to_blue, blue_to_red, red_to_yellow, yellow_to_red

Colormap to use for thickness visualization, lower to higher values.

Default: 'red_to_yellow'

--color_range

Specify the range for the colorbar (2 values: min max). Defaults to automatic choice. (e.g. –color_range 0 10).

--legend

Legend for the colorbar.

Default: 'Thickness (mm)'

--twoD

Generate 2D visualization instead of 3D mesh.

Default: False

-v, --verbose

Enable verbose (pass twice for debug-output).

Default: 0

Usage Examples

3D Visualization

To visualize a 3D template generated by fastsurfer_cc.py (using --slice_selection all --save_template_dir ...), point the script to the exported template directory:

python3 cc_visualization.py \
    --template_dir /data/templates/sub001/cc_template \
    --output_dir /data/visualizations/sub001

2D Visualization

To visualize a 2D template (using --slice_selection middle --save_template_dir ...):

python3 cc_visualization.py \
    --template_dir /data/templates/sub001/cc_template \
    --output_dir /data/visualizations/sub001 \
    --twoD

Note

The --template_dir is the required way to load the templates produced by fastsurfer_cc.py.

Outputs

3D Mode Outputs (default):
  • cc_mesh.vtk: VTK format mesh file for 3D visualization

  • cc_mesh.fssurf: FreeSurfer surface format

  • cc_mesh_overlay.curv: FreeSurfer overlay file with thickness values

  • cc_mesh.html: Interactive 3D mesh visualization

  • cc_mesh_snap.png: Snapshot image of the 3D mesh

  • midslice_2d.png: 2D visualization of the middle slice

2D Mode Outputs (when --twoD is specified):
  • cc_thickness_2d.png: 2D contour visualization with thickness colormap