Skip to content

Tests#43

Open
aylward wants to merge 5 commits intoProject-MONAI:mainfrom
aylward:tests
Open

Tests#43
aylward wants to merge 5 commits intoProject-MONAI:mainfrom
aylward:tests

Conversation

@aylward
Copy link
Copy Markdown
Collaborator

@aylward aylward commented Apr 8, 2026

Summary by CodeRabbit

  • Documentation

    • Removed VISTA-3D docs & examples across guides and API map; updated CI status badge and segmentation docs to reflect remaining methods.
  • Chores

    • Added Codecov authentication in CI; ignored a local settings file.
  • Refactor

    • Removed the VISTA-3D segmentation backend and related public exports; ensemble now delegates to TotalSegmentator.
  • Tests

    • Updated test data download handling and removed VISTA-3D test fixtures/suites.

Copilot AI review requested due to automatic review settings April 8, 2026 14:05
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

Walkthrough

Removed VISTA‑3D segmentation code and tests, updated ensemble/workflow to rely on TotalSegmentator, added Codecov tokens to CI uploads, revised numerous docs and API map entries to remove VISTA‑3D references, changed a test data URL and fixture error handling, and added .claude/settings.local.json to .gitignore.

Changes

Cohort / File(s) Summary
CI & Codecov
/.github/workflows/ci.yml, /.github/workflows/test-slow.yml
Added token: ${{ secrets.CODECOV_TOKEN }} to Codecov upload steps; removed a commented note line.
Removed VISTA‑3D Modules & Tests
src/physiomotion4d/segment_chest_vista_3d.py, src/physiomotion4d/segment_chest_vista_3d_nim.py, tests/test_segment_chest_vista_3d.py, experiments/.../test_vista3d_*.py
Deleted VISTA‑3D implementation modules, NIM variant, associated tests and example experiment scripts.
Ensemble & Workflow Updates
src/physiomotion4d/segment_chest_ensemble.py, src/physiomotion4d/workflow_convert_ct_to_vtk.py, src/physiomotion4d/__init__.py
SegmentChestEnsemble now subclasses TotalSegmentator (ensemble logic removed); WorkflowConvertCTToVTK no longer supports vista_3d; package top-level no longer re-exports VISTA classes.
Documentation & API Map
docs/API_MAP.md, docs/**/*.rst, docs/examples.rst, docs/developer/...
Removed VISTA‑3D docs pages and references across API, examples, quickstart, developer and testing docs; updated CI badge to nightly and various examples to use TotalSegmentator.
Tests & Fixtures
tests/conftest.py, tests/*README*.md, tests/GITHUB_WORKFLOWS.md, tests/TESTING_GUIDE.md
Changed TruncalValve download URL, added import os, switched HTTPError→URLError handling and conditional pytest.fail()/skip(); removed VISTA‑3D fixture exposure and adjusted test docs/skip commands.
Experiments & Scripts
experiments/..., experiments/Lung-GatedCT_To_USD/...
Removed or simplified experiment scripts referencing VISTA‑3D; remaining scripts now use TotalSegmentator and drop VISTA‑3D branches.
Project Metadata & CLI
pyproject.toml, src/physiomotion4d/cli/convert_ct_to_vtk.py
Dropped vista-3d keyword and removed mypy exclude for vista3d; shortened CLI epilog/help text removing VISTA‑3D example.
Repo Config
.claude/.gitignore
Added settings.local.json to ignore local Claude settings.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I nibbled through code with a twitch and a hop,

Farewell VISTA‑3D — I helped the docs stop.
CI got a token, fixtures fetch with care,
Ensemble now follows one trusty hare.
Local secrets tucked where no commits dare.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Tests' is vague and generic, providing no meaningful information about the actual changes made to the codebase. Consider a more descriptive title that captures the main intent, such as 'Remove VISTA-3D segmentation support' or 'Deprecate VISTA-3D and VISTA-3D NIM modules'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

Copy link
Copy Markdown

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 tightens up the project’s testing and CI plumbing by improving external test-data download behavior in CI, ensuring Codecov uploads include the repo token, and aligning documentation badges with the nightly health workflow.

Changes:

  • Update the TruncalValve test-data download URL and fail (instead of skip) on download HTTP errors when running in CI.
  • Add CODECOV_TOKEN to Codecov upload steps in CI and slow-test workflows.
  • Update docs CI badge to point at the nightly-health.yml workflow and refresh the generated API map.

Reviewed changes

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

Show a summary per file
File Description
tests/conftest.py Switches test-data download URL and changes CI behavior to fail on download HTTP errors.
docs/index.rst Updates the CI badge to reflect the nightly health workflow.
docs/API_MAP.md Regenerates API map line numbers after code changes.
.github/workflows/test-slow.yml Adds Codecov token to coverage upload.
.github/workflows/ci.yml Adds Codecov token to coverage uploads across unit/integration/GPU jobs.
.claude/.gitignore Ignores local Claude settings file.

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

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@tests/conftest.py`:
- Around line 297-305: The except block currently catches urllib.error.HTTPError
only, so network/DNS failures (urllib.error.URLError) bypass the CI/local
fail-or-skip logic; change the handler to catch urllib.error.URLError (or both
urllib.error.HTTPError and urllib.error.URLError) instead of only HTTPError so
that the same pytest.fail/pytest.skip behavior (using data_dir) runs for
network-level errors; update the except clause where urllib.error.HTTPError is
referenced to use urllib.error.URLError (or a tuple) and keep the existing msg,
pytest.fail and pytest.skip calls unchanged.
🪄 Autofix (Beta)

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

Run ID: a5a7fc0d-8da7-480b-9770-0a4561357932

📥 Commits

Reviewing files that changed from the base of the PR and between 782a7a4 and 51e812b.

📒 Files selected for processing (6)
  • .claude/.gitignore
  • .github/workflows/ci.yml
  • .github/workflows/test-slow.yml
  • docs/API_MAP.md
  • docs/index.rst
  • tests/conftest.py

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@782a7a4). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/physiomotion4d/segment_chest_ensemble.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #43   +/-   ##
=======================================
  Coverage        ?   13.98%           
=======================================
  Files           ?       47           
  Lines           ?     6409           
  Branches        ?        0           
=======================================
  Hits            ?      896           
  Misses          ?     5513           
  Partials        ?        0           
Flag Coverage Δ
integration-tests 13.98% <66.66%> (?)
unittests 13.60% <66.66%> (?)

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

☔ View full report in Codecov by Sentry.
📢 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.

Copilot AI review requested due to automatic review settings April 8, 2026 15:12
Copy link
Copy Markdown

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

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


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

Comment on lines 294 to +298
urllib.request.urlretrieve(input_image_url, str(input_image_filename))
print(f"Downloaded to {input_image_filename}")
except urllib.error.HTTPError as e:
pytest.skip(
f"Could not download test data: {e}. Please manually place TruncalValve_4DCT.seq.nrrd in {data_dir}"
except urllib.error.URLError as e:
msg = (
f"Could not download test data: {e}. "
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The except urllib.error.URLError clause will fail if triggered because urllib.error isn’t imported (only urllib.request is). Import urllib.error (or from urllib.error import URLError) so download failures are handled as intended.

Copilot uses AI. Check for mistakes.
Comment on lines 23 to 26
**Segmentation Classes**:
* :doc:`base` - Base class for all segmentation methods
* :doc:`totalsegmentator` - TotalSegmentator implementation
* :doc:`vista3d` - VISTA-3D foundation model
* :doc:`vista3d_nim` - VISTA-3D NIM for cloud deployment
* :doc:`ensemble` - Ensemble segmentation
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

This PR removes the vista3d/vista3d_nim pages from the segmentation docs, but other docs in the repo still reference :doc:vista3d`` (e.g., docs/api/segmentation/base.rst and `docs/api/segmentation/totalsegmentator.rst`) and `docs/api/workflows.rst` mentions `segmentation_method="vista3d"`. Those references should be updated (or stub pages kept) to avoid broken Sphinx links.

Copilot uses AI. Check for mistakes.
Comment on lines +263 to 270
from physiomotion4d import SegmentChestTotalSegmentator
import itk

# Initialize VISTA-3D segmentation
segmenter = SegmentChestVista3D()
# Initialize TotalSegmentator segmentation
segmenter = SegmentChestTotalSegmentator()

# Load and segment image
image = itk.imread("chest_ct.nrrd")
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

In this example, SegmentChestTotalSegmentator.segment() returns a dict of masks (e.g., result['labelmap'], result['heart']). The snippet below currently assigns to masks = ... and then unpacks multiple values; after switching to TotalSegmentator the example should be updated to use the dict keys instead of tuple unpacking.

Copilot uses AI. Check for mistakes.
Comment on lines +119 to 126
from physiomotion4d import SegmentChestTotalSegmentator
import itk

# Initialize segmenter
segmenter = SegmentChestVista3D()
segmenter = SegmentChestTotalSegmentator()

# Load and segment image
image = itk.imread("chest_ct.nrrd")
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

SegmentChestTotalSegmentator.segment() returns a dict of masks, but this section’s code block unpacks the return value into multiple variables. After updating the import/constructor here, please also update the subsequent lines to use keys like result['heart'] / result['labelmap'] rather than tuple unpacking.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
docs/developer/segmentation.rst (1)

104-128: Single-method ensemble example may be misleading.

The ensemble documentation states it "combines multiple segmentation methods" (line 105), but the example uses only methods=['totalsegmentator']. This inconsistency could confuse developers.

Recommendation: Either update the feature description to note that it currently uses a single backend, or remove the methods parameter from the example since SegmentChestEnsemble now directly inherits and delegates to SegmentChestTotalSegmentator.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/developer/segmentation.rst` around lines 104 - 128, The docs example is
inconsistent: SegmentChestEnsemble claims to combine multiple methods but the
example passes methods=['totalsegmentator']; update the documentation to remove
or clarify the misleading parameter. Edit the example usage for
SegmentChestEnsemble to either (A) remove the methods argument and show direct
instantiation (since SegmentChestEnsemble delegates to
SegmentChestTotalSegmentator), or (B) change the feature text to state it
currently uses a single backend and keep the example; reference
SegmentChestEnsemble, methods, and SegmentChestTotalSegmentator when making the
change.
docs/examples.rst (1)

106-109: Single-method ensemble may confuse users.

The ensemble example now uses only methods=['totalsegmentator'], which technically isn't an ensemble (ensembles combine multiple methods). While this aligns with the VISTA-3D removal, users may find it confusing to use an "ensemble" class with a single method.

Consider either:

  1. Updating the example text to clarify that SegmentChestEnsemble currently delegates to a single backend but maintains API stability
  2. Recommending users call SegmentChestTotalSegmentator directly for single-method segmentation
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/examples.rst` around lines 106 - 109, Update the example to avoid
confusion about using an "ensemble" with a single method: in the docs
surrounding SegmentChestEnsemble mention that when methods=['totalsegmentator']
the class currently delegates to a single backend for API stability, and add a
brief note recommending using SegmentChestTotalSegmentator directly for
single-method cases; reference the SegmentChestEnsemble constructor (methods and
fusion_strategy parameters) and the alternative SegmentChestTotalSegmentator
symbol so readers can choose the clearer direct class for single-method
segmentation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@docs/developer/segmentation.rst`:
- Around line 104-128: The docs example is inconsistent: SegmentChestEnsemble
claims to combine multiple methods but the example passes
methods=['totalsegmentator']; update the documentation to remove or clarify the
misleading parameter. Edit the example usage for SegmentChestEnsemble to either
(A) remove the methods argument and show direct instantiation (since
SegmentChestEnsemble delegates to SegmentChestTotalSegmentator), or (B) change
the feature text to state it currently uses a single backend and keep the
example; reference SegmentChestEnsemble, methods, and
SegmentChestTotalSegmentator when making the change.

In `@docs/examples.rst`:
- Around line 106-109: Update the example to avoid confusion about using an
"ensemble" with a single method: in the docs surrounding SegmentChestEnsemble
mention that when methods=['totalsegmentator'] the class currently delegates to
a single backend for API stability, and add a brief note recommending using
SegmentChestTotalSegmentator directly for single-method cases; reference the
SegmentChestEnsemble constructor (methods and fusion_strategy parameters) and
the alternative SegmentChestTotalSegmentator symbol so readers can choose the
clearer direct class for single-method segmentation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 62bbd42b-6451-4a24-a998-c4c46dfae4d4

📥 Commits

Reviewing files that changed from the base of the PR and between 26314ee and b10c57b.

📒 Files selected for processing (31)
  • .github/workflows/ci.yml
  • CLAUDE.md
  • README.md
  • docs/API_MAP.md
  • docs/README.md
  • docs/api/index.rst
  • docs/api/segmentation/ensemble.rst
  • docs/api/segmentation/index.rst
  • docs/api/segmentation/vista3d.rst
  • docs/api/segmentation/vista3d_nim.rst
  • docs/developer/architecture.rst
  • docs/developer/segmentation.rst
  • docs/examples.rst
  • docs/quickstart.rst
  • docs/testing.rst
  • experiments/Heart-GatedCT_To_USD/test_vista3d_class.py
  • experiments/Heart-GatedCT_To_USD/test_vista3d_inMem.py
  • experiments/Lung-GatedCT_To_USD/0-register_dirlab_4dct.py
  • experiments/Lung-GatedCT_To_USD/Experiment_SegReg.py
  • experiments/README.md
  • pyproject.toml
  • src/physiomotion4d/__init__.py
  • src/physiomotion4d/cli/convert_ct_to_vtk.py
  • src/physiomotion4d/segment_chest_ensemble.py
  • src/physiomotion4d/workflow_convert_ct_to_vtk.py
  • tests/GITHUB_WORKFLOWS.md
  • tests/README.md
  • tests/TESTING_GUIDE.md
  • tests/conftest.py
  • tests/test_experiments.py
  • tests/test_segment_chest_vista_3d.py
💤 Files with no reviewable changes (11)
  • CLAUDE.md
  • experiments/Lung-GatedCT_To_USD/0-register_dirlab_4dct.py
  • tests/test_experiments.py
  • docs/api/segmentation/vista3d_nim.rst
  • docs/api/segmentation/vista3d.rst
  • experiments/Lung-GatedCT_To_USD/Experiment_SegReg.py
  • pyproject.toml
  • experiments/Heart-GatedCT_To_USD/test_vista3d_class.py
  • src/physiomotion4d/init.py
  • tests/test_segment_chest_vista_3d.py
  • experiments/Heart-GatedCT_To_USD/test_vista3d_inMem.py
✅ Files skipped from review due to trivial changes (4)
  • src/physiomotion4d/cli/convert_ct_to_vtk.py
  • experiments/README.md
  • docs/README.md
  • README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/ci.yml

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