Skip to content

ENH: Heart models are now surfaces, save as vtp - #109

Merged
aylward merged 1 commit into
Project-MONAI:mainfrom
aylward:heart_models_now_surfaces
Aug 5, 2026
Merged

ENH: Heart models are now surfaces, save as vtp#109
aylward merged 1 commit into
Project-MONAI:mainfrom
aylward:heart_models_now_surfaces

Conversation

@aylward

@aylward aylward commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Documentation
    • Updated the heart-fitting tutorial to use .vtp mesh output files.
    • Removed outdated commented examples for custom PCA model paths.

Copilot AI lite review requested due to automatic review settings August 5, 2026 17:49
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Walkthrough

The heart fitting tutorial now saves template and registered template meshes with .vtp extensions. Commented BYOD PCA model path examples were removed.

Changes

Heart tutorial mesh outputs

Layer / File(s) Summary
Update mesh output extensions
tutorials/tutorial_07_heart_fit_statistical_model_to_patient.py
Template and registered template mesh outputs now use .vtp instead of .vtu.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change from volumetric meshes to surface meshes saved in VTP format.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tutorials/tutorial_07_heart_fit_statistical_model_to_patient.py`:
- Line 177: Update the registered mesh output path in the tutorial’s
mesh-writing flow to use the filename basename expected by the integration test,
changing only the extension as required by the existing contract. Keep the
producer and consumer names aligned, including any related references to this
output.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ce0afc8b-3205-47cb-979e-78c52a91e424

📥 Commits

Reviewing files that changed from the base of the PR and between 01a9298 and da0b362.

📒 Files selected for processing (1)
  • tutorials/tutorial_07_heart_fit_statistical_model_to_patient.py

registered_mesh = workflow_results["registered_template_model"]
registered_mesh.save(
str(output_dir / f"{project_name}_template_mesh_registered.vtu")
str(output_dir / f"{project_name}_template_mesh_registered.vtp")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Align the registered mesh filename with the integration test.

Line 177 writes *_template_mesh_registered.vtp, but tests/test_tutorials.py checks for *_template_surface_registered.vtp. The tutorial test will fail because the producer and consumer use different basenames. Preserve the existing filename contract while changing only the extension, or update the test and all consumers together.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tutorials/tutorial_07_heart_fit_statistical_model_to_patient.py` at line 177,
Update the registered mesh output path in the tutorial’s mesh-writing flow to
use the filename basename expected by the integration test, changing only the
extension as required by the existing contract. Keep the producer and consumer
names aligned, including any related references to this output.

Copilot AI left a comment

Copy link
Copy Markdown

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 updates Tutorial 7’s output artifacts to align with the new convention that heart “models” are treated as surfaces and are saved as VTK PolyData (.vtp) rather than unstructured grids (.vtu).

Changes:

  • Remove outdated “BYOD” example paths for .vtu/PCA JSON inputs.
  • Update saved template/registered “mesh” outputs from .vtu to .vtp in the tutorial script.
Suppressed comments (1)

tutorials/tutorial_07_heart_fit_statistical_model_to_patient.py:178

  • Saving registered_template_model as .vtp assumes the returned dataset is pv.PolyData. Since the workflow returns pv.DataSet here, this can break if the registered model is an UnstructuredGrid. Either keep .vtu for volumetric meshes, or extract a surface before writing .vtp.
    registered_mesh.save(
        str(output_dir / f"{project_name}_template_mesh_registered.vtp")
    )

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

template_mesh = workflow.pca_template_model
assert template_mesh is not None, "pca_template_model must be set after process()"
template_mesh.save(str(output_dir / f"{project_name}_template_mesh.vtu"))
template_mesh.save(str(output_dir / f"{project_name}_template_mesh.vtp"))
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 36.55%. Comparing base (01a9298) to head (da0b362).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #109   +/-   ##
=======================================
  Coverage   36.55%   36.55%           
=======================================
  Files          72       72           
  Lines        8503     8503           
=======================================
  Hits         3108     3108           
  Misses       5395     5395           
Flag Coverage Δ
integration-tests 36.35% <ø> (?)
unittests 36.55% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aylward
aylward merged commit 68fea2e into Project-MONAI:main Aug 5, 2026
12 checks passed
@aylward
aylward deleted the heart_models_now_surfaces branch August 5, 2026 19:05
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.

2 participants