Skip to content

CC Visualization fix#829

Merged
m-reuter merged 7 commits into
Deep-MI:devfrom
ClePol:cc-divbyzero-dev
May 27, 2026
Merged

CC Visualization fix#829
m-reuter merged 7 commits into
Deep-MI:devfrom
ClePol:cc-divbyzero-dev

Conversation

@ClePol
Copy link
Copy Markdown
Member

@ClePol ClePol commented May 27, 2026

This PR fixed a small bug that would affect visualization of corpus callosum thickness estimates. Interpolation of thickness values could fail when the interpolated point and the original closest point would be equal, causing nan values in the results.

The fix is to take the value of the equal point directly, instead of weighting by distance.

@ClePol ClePol changed the title Cc divbyzero dev CC Visualization fix May 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 fixes NaN thickness values in corpus callosum thickness visualization by handling the zero-distance interpolation case explicitly (when an interpolated point coincides with an existing contour point).

Changes:

  • Update insert_point_with_thickness() to detect existing points (within a tolerance) and return the existing index instead of inserting a duplicate point.
  • Extend insert_point_with_thickness() return (when return_index=True) with an inserted: bool flag and adjust endpoint index bookkeeping accordingly.
  • Guard fill_thickness_values() against divide-by-zero by directly using the thickness value(s) of zero-distance neighbor(s).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
CorpusCallosum/shape/thickness.py Avoids duplicate-point insertion and propagates an inserted flag to prevent incorrect endpoint index shifts.
CorpusCallosum/shape/contour.py Prevents NaNs during thickness interpolation when closest-distance is effectively zero.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CorpusCallosum/shape/thickness.py Outdated
Comment thread CorpusCallosum/shape/thickness.py
ClePol and others added 2 commits May 27, 2026 17:01
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@m-reuter m-reuter merged commit 21407ba into Deep-MI:dev May 27, 2026
3 checks passed
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