Skip to content

Better cc visualization - #858

Open
ClePol wants to merge 5 commits into
Deep-MI:devfrom
ClePol:cc_visualization
Open

Better cc visualization#858
ClePol wants to merge 5 commits into
Deep-MI:devfrom
ClePol:cc_visualization

Conversation

@ClePol

@ClePol ClePol commented Aug 28, 2026

Copy link
Copy Markdown
Member

This change only affects the cc visualization script, that is not called in FastSurfer default workflows.

In response to a user request, I improved the "expert script" that has it's own entrpoint.
Most notably

  • better documentation
  • consistent ordering between script inputs and stats outputs
  • dedicated mode to plot p-values on the cc
  • added a default fsaverage contour, so users don't have to mount it in manually (also makes the code cleaner)

An example command is

docker run --rm \
    --user "$(id -u):$(id -g)" \
    --volume "$PWD/dummy_p_values.csv:/input/p_values.csv:ro" \
    --volume "$PWD:/output" \
    --entrypoint /fastsurfer/tools/Docker/entrypoint.sh \
    deepmi/fastsurfer:latest \
    python3 /fastsurfer/CorpusCallosum/cc_visualization.py \
    --values_file /input/p_values.csv \
    --output_dir /output \
    --mode p-value \
    --colormap yellow_to_red \
    --log_scale \
    --upper_threshold 0.05 \
    --threshold_color gray \
    --legend "p-value (log scale)" \
    --title "P-values on fsaverage corpus callosum" \
    --output_name dummy_p_values_fsaverage_2d.png \
    --smoothing_window 0 \
    --twoD

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the CorpusCallosum “expert” visualization tooling by adding a standalone --values_file workflow (e.g., p-values on an fsaverage contour), improving ordering/validation in plotting, and updating documentation to better explain expected input formats.

Changes:

  • Added a --values_file mode to cc_visualization.py to plot 1D anterior→posterior value vectors (p-value/icc/thickness) on a bundled fsaverage corpus callosum contour.
  • Added CCContour.get_thickness_profile() plus stricter input validation and extended plotting options (log scaling, thresholds, configurable colormap, label overrides).
  • Bundled a precomputed fsaverage CC contour (fsaverage_cc_contour.json) and updated docs/README and measure descriptions accordingly.

Reviewed changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pyproject.toml Tightens Sphinx argparse dependency constraint for doc builds.
doc/scripts/cc_visualization.rst Expands usage docs, clarifies thickness file vs profile semantics, adds --values_file examples and figure.
doc/overview/modules/CC.md Clarifies definitions/formulas for CC metrics and thickness profile description.
CorpusCallosum/utils/types.py Updates TypedDict docstrings to match clarified metric definitions.
CorpusCallosum/shape/metrics.py Improves calculate_cc_index docstring and citation, aligns stated defaults.
CorpusCallosum/shape/contour.py Adds get_thickness_profile() and extends/validates plot_contour_colorfill() (log scale, thresholds, colormap).
CorpusCallosum/README.md Links to the dedicated CC visualization documentation page.
CorpusCallosum/data/constants.py Adds a constant path for the bundled fsaverage CC contour JSON.
CorpusCallosum/data/fsaverage_cc_template.py Switches fsaverage contour loading to a bundled JSON-derived contour.
CorpusCallosum/data/fsaverage_cc_contour.json Adds the bundled precomputed fsaverage CC contour data.
CorpusCallosum/cc_visualization.py Adds --values_file entrypoint logic and new CLI options for value plotting.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread CorpusCallosum/data/fsaverage_cc_template.py
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@m-reuter

Copy link
Copy Markdown
Member

@ClePol can you reduce the file size of the example png ?

m-reuter added a commit to m-reuter/FastSurfer that referenced this pull request Aug 30, 2026
@ClePol

ClePol commented Aug 31, 2026

Copy link
Copy Markdown
Member Author

@ClePol can you reduce the file size of the example png ?

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants