ENH: Heart models are now surfaces, save as vtp - #109
Conversation
WalkthroughThe heart fitting tutorial now saves template and registered template meshes with ChangesHeart tutorial mesh outputs
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 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") |
There was a problem hiding this comment.
🗄️ 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.
There was a problem hiding this comment.
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
.vtuto.vtpin the tutorial script.
Suppressed comments (1)
tutorials/tutorial_07_heart_fit_statistical_model_to_patient.py:178
- Saving
registered_template_modelas.vtpassumes the returned dataset ispv.PolyData. Since the workflow returnspv.DataSethere, this can break if the registered model is anUnstructuredGrid. Either keep.vtufor 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 Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit
.vtpmesh output files.