Skip to content

ENH: Fix directory structure for CHOP-Valve data#92

Merged
aylward merged 3 commits into
Project-MONAI:mainfrom
aylward:chop_valve
Jul 23, 2026
Merged

ENH: Fix directory structure for CHOP-Valve data#92
aylward merged 3 commits into
Project-MONAI:mainfrom
aylward:chop_valve

Conversation

@aylward

@aylward aylward commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Bug Fixes
    • Updated CHOP-Valve4D download, extraction, and verification to align with the corrected archive layout.
    • Improved download efficiency by skipping re-downloads when the expected dataset structure is already present.
  • Tests
    • Updated CHOP-Valve4D test fixtures to reflect the revised zip member paths, ensuring coverage matches the new extraction behavior.

Copilot AI review requested due to automatic review settings July 21, 2026 17:23

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4a50d048-df83-440b-a909-b8d2ab4b26dc

📥 Commits

Reviewing files that changed from the base of the PR and between 28b8030 and 0acc929.

📒 Files selected for processing (2)
  • src/physiotwin4d/data_download_tools.py
  • tests/test_download_heart_data.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/test_download_heart_data.py
  • src/physiotwin4d/data_download_tools.py

Walkthrough

CHOP-Valve4D archives now extract into the parent dataset directory. Population and verification checks infer layouts from target directory names, and test archives include subdirectory-qualified members.

Changes

CHOP-Valve4D dataset layout

Layer / File(s) Summary
Extraction and population validation
src/physiotwin4d/data_download_tools.py
Archive extraction targets target_dir.parent; population and verification checks derive the asset layout from each target directory.
Archive fixture alignment
tests/test_download_heart_data.py
Test archives place entries beneath their corresponding asset subdirectories for complete and partial extraction cases.

Estimated code review effort: 2 (Simple) | ~10 minutes

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 reflects the main change: fixing the CHOP-Valve data directory layout.
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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/physiotwin4d/data_download_tools.py (1)

247-251: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Flattened directory paths break data verification and mesh extraction.

Passing data_dir directly to _CHOPValve4DSubdirIsPopulated causes it to look for marker files (like RVOT28-Dias.nii.gz or *.vtk) in the root dataset directory rather than the appropriate subdirectories.

  • If the zip archives extract flat into data_dir, Alterra and TPV25 meshes will overwrite each other, and downloading one will cause the other to be skipped (since any(target_dir.glob("*.vtk")) matches both).
  • If the zip archives natively contain subdirectories (e.g., CT/), extracting to data_dir avoids double-folders, but the population check will fail because it looks for data_dir / "RVOT28-Dias.nii.gz" instead of data_dir / "CT" / "RVOT28-Dias.nii.gz". This causes VerifyCHOPValve4DData to always fail and triggers re-downloads on every run.

Restore the subdirectory paths for the checks to correctly isolate the assets:

  • src/physiotwin4d/data_download_tools.py#L247-L251: Pass data_dir / subdir_name to _CHOPValve4DSubdirIsPopulated instead of target_dir. If you are extracting to data_dir to avoid double-folders, you can keep target_dir = data_dir for the _DownloadAndExtractZip call.
  • src/physiotwin4d/data_download_tools.py#L307-L311: Append the respective subdirectory names by passing data_dir / "CT", data_dir / "Alterra", and data_dir / "TPV25" to _CHOPValve4DSubdirIsPopulated.
🤖 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 `@src/physiotwin4d/data_download_tools.py` around lines 247 - 251, The
population check in the download loop must use each asset’s subdirectory rather
than the root data directory. In src/physiotwin4d/data_download_tools.py lines
247-251, pass data_dir / subdir_name to _CHOPValve4DSubdirIsPopulated while
preserving target_dir for extraction; in lines 307-311, pass data_dir / "CT",
data_dir / "Alterra", and data_dir / "TPV25" to the corresponding
_CHOPValve4DSubdirIsPopulated calls.
🤖 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.

Outside diff comments:
In `@src/physiotwin4d/data_download_tools.py`:
- Around line 247-251: The population check in the download loop must use each
asset’s subdirectory rather than the root data directory. In
src/physiotwin4d/data_download_tools.py lines 247-251, pass data_dir /
subdir_name to _CHOPValve4DSubdirIsPopulated while preserving target_dir for
extraction; in lines 307-311, pass data_dir / "CT", data_dir / "Alterra", and
data_dir / "TPV25" to the corresponding _CHOPValve4DSubdirIsPopulated calls.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d02e7b02-a6d8-4bcb-acd7-9dd0caecd711

📥 Commits

Reviewing files that changed from the base of the PR and between e31c8af and 6a78bf0.

📒 Files selected for processing (1)
  • src/physiotwin4d/data_download_tools.py

Copilot AI review requested due to automatic review settings July 21, 2026 19:10

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 22, 2026 13:31

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 23, 2026 11:53

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@aylward
aylward merged commit 2d7bbbb into Project-MONAI:main Jul 23, 2026
10 checks passed
@aylward
aylward deleted the chop_valve branch July 23, 2026 12:54
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