Skip to content

ENH: Upaded AI agents for consistency and make physicsnemo optional#60

Merged
aylward merged 3 commits into
Project-MONAI:mainfrom
aylward:physicsnemooptional
May 23, 2026
Merged

ENH: Upaded AI agents for consistency and make physicsnemo optional#60
aylward merged 3 commits into
Project-MONAI:mainfrom
aylward:physicsnemooptional

Conversation

@aylward
Copy link
Copy Markdown
Collaborator

@aylward aylward commented May 22, 2026

Summary by CodeRabbit

  • New Features

    • Added Greedy registration and combined Greedy+ICON options for time‑series image registration.
  • Documentation

    • Standardized on LPS for internal image/frame conventions and clarified export conversion to USD; documented use of the public VTK→USD entrypoint only.
    • Added PhysicsNeMo install note (optional, Python ≥ 3.11), clearer tutorial/quickstart updates, and regenerated API map.
  • Testing

    • Introduced --run-physicsnemo and --run-all pytest flags, prefers real-data fixture tests and baseline/result storage guidance; added a Greedy init test.
  • Chores

    • Lowered minimum Python support to 3.10 and updated CI/test workflow instructions.

Copilot AI review requested due to automatic review settings May 22, 2026 19:44
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3a7a7f97-b383-416c-b00f-7e8dceabaadb

📥 Commits

Reviewing files that changed from the base of the PR and between e1adcc0 and 0dd3344.

📒 Files selected for processing (1)
  • .gitignore
✅ Files skipped from review due to trivial changes (1)
  • .gitignore

Walkthrough

Adds Greedy and combined greedy_icon registration paths with iteration configuration and tests; updates many docs, agent skills, CI workflows, pytest run-buckets, convention checks, and tutorial PhysicsNeMo install/guarding.

Changes

Registration Greedy support

Layer / File(s) Summary
Registration constants & docs
src/physiomotion4d/register_time_series_images.py
Module docstring, imports, and new REGISTRATION_METHODS documented.
Init, iteration setter, API map
src/physiomotion4d/register_time_series_images.py, docs/API_MAP.md, tests/*
init accepts new methods, adds Greedy registrar and set_number_of_iterations_greedy, and API_MAP/test listings refreshed.
register_time_series flow and branching
src/physiomotion4d/register_time_series_images.py
Extend register_time_series, reference-frame and forward/backward loops for greedy and combined ants_icon/greedy_icon, passing initial_forward_transform into ICON refinement.
Tests for Greedy initialization & iterations
tests/test_register_time_series_images.py
Add tests verifying greedy initialization and iteration-setting behavior.

Agent, CI, docs, and skills updates

Layer / File(s) Summary
Agent docs & universal rules
.agents/agents/architecture.md, .agents/agents/implementation.md, .agents/agents/testing.md, AGENTS.md
Clarify LPS internal invariant, require ConvertVTKToUSD public entry point, limit PhysioMotion4DBase inheritance, revise testing guidance toward fixture-driven real data, and mark LPS→USD-Y-up as high-risk.
New skills and ai_agent updates
.agents/skills/*, utils/ai_agent_github_reviews.py
Add check-conventions, regen-api-map, review-pr skill docs; update ai agent rejection rules (LPS wording, no emojis, Windows main guard), and clean up Codex prompt file on success.
CI, pytest buckets, and test harness
.github/workflows/*, tests/conftest.py, tests/README.md
Add --run-physicsnemo and --run-all, switch some CI runners to Python 3.11 and include [physicsnemo] extra in GPU installs, centralize run-bucket logic and marker registration.
README, tutorials, and contributing docs
README.md, tutorials/*, docs/*
Document optional physicsnemo extra and Python >= 3.11 for Tutorial 9; update examples and contributing/testing docs to reference new run-bucket flags and install instructions.
Packaging, mypy, and ignore rules
pyproject.toml, .gitignore
Lower requires-python to >=3.10, adjust optional extras and dependency bounds (move nvidia-physicsnemo to extra), set mypy python_version, add pytest marker, and ignore AI/skill intermediate files.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant RegisterTimeSeriesImages
  participant GreedyRegistrar
  participant ANTsRegistrar
  participant ICONRegistrar
  participant TransformStore

  User->>RegisterTimeSeriesImages: call register_time_series(registration_method="greedy"|"ants_icon"|"greedy_icon")
  RegisterTimeSeriesImages->>GreedyRegistrar: configure & run initial stage (if greedy or greedy_icon)
  RegisterTimeSeriesImages->>ANTsRegistrar: configure & run initial stage (if ants or ants_icon)
  GreedyRegistrar->>TransformStore: produce initial_forward_transform
  ANTsRegistrar->>TransformStore: produce initial_forward_transform
  RegisterTimeSeriesImages->>ICONRegistrar: call ICON refinement with initial_forward_transform
  ICONRegistrar->>TransformStore: produce refined forward/inverse transforms
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title is partially related to the changeset. It references making PhysicsNeMo optional (a key change), but contains a typo ('Upaded' instead of 'Updated') and omits other substantial changes like new agent skills, Greedy registration support, and comprehensive documentation updates. Correct the typo to 'Updated' and consider expanding the title to better reflect the scope, such as 'ENH: Update AI agents for consistency, make physicsnemo optional, and add Greedy registration support' or similar to capture the more comprehensive nature of the changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.
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.

✏️ 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 updates repository automation/docs to make PhysicsNeMo an optional dependency (used only for Tutorial 9), and extends time-series registration to support Greedy and Greedy→ICON refinement while standardizing test-bucket gating via a --run-all convenience flag.

Changes:

  • Make PhysicsNeMo opt-in via a new [physicsnemo] extra and add runtime import guards + documentation updates for Tutorial 9.
  • Add Greedy (and greedy_icon) support to RegisterTimeSeriesImages, plus unit-test coverage for Greedy initialization/iteration configuration.
  • Add --run-physicsnemo and --run-all pytest flags and update CI/workflows/docs to use the new buckets.

Reviewed changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
utils/ai_agent_github_reviews.py Tightens AI review “hard rules” (coords/LPS vs RAS, emoji ban, Windows mp guard reminder).
tutorials/tutorial_09_physicsnemo_mesh_stage_model.py Adds PhysicsNeMo optional-import guard and documents extra install requirement.
tutorials/README.md Notes Tutorial 9 requires the [physicsnemo] extra.
tests/test_register_time_series_images.py Adds Greedy init test + Greedy iteration setter coverage.
tests/README.md Documents --run-physicsnemo and --run-all buckets.
tests/conftest.py Implements --run-physicsnemo and --run-all bucket enablement + marker registration.
src/physiomotion4d/register_time_series_images.py Adds Greedy and greedy_icon support + Greedy iteration configuration API.
README.md Documents PhysicsNeMo as an optional extra and clarifies Python version constraints.
pyproject.toml Drops base Python requirement to 3.10; moves PhysicsNeMo to optional deps.
docs/tutorials.rst Adds “extra install” note for Tutorial 9 PhysicsNeMo requirement.
docs/testing.rst Documents --run-physicsnemo and --run-all; updates CI runner guidance.
docs/quickstart.rst Clarifies Tutorial 9 needs optional physicsnemo extra (Python >= 3.11).
docs/developer/core.rst Updates contributor test guidance to include --run-physicsnemo / --run-all.
docs/contributing.rst Updates testing section with new buckets / --run-all.
docs/api/registration/time_series.rst Updates time-series registration docs to include Greedy and greedy_icon.
docs/API_MAP.md Regenerated API map reflecting public API/doc shifts.
CLAUDE.md Updates agent commands/docs (adds --run-all, regen API map guidance, convention checks).
AGENTS.md Updates contributor/agent rules and adds environment notes.
.gitignore Ignores .claude AI tool state directory.
.github/workflows/test-slow.yml Switches GPU slow workflow to install physicsnemo extra and use --run-all.
.github/workflows/README.md Updates workflow docs/commands to match new buckets and extras.
.github/workflows/nightly-health.yml Switches nightly GPU health run to install physicsnemo extra and use --run-all.
.github/workflows/ci.yml Switches GPU workflow to install physicsnemo extra and use --run-all.
.agents/skills/review-pr/SKILL.md Adds a “review-pr” skill doc for invoking the repo PR-review driver.
.agents/skills/regen-api-map/SKILL.md Adds a “regen-api-map” skill doc for regenerating docs/API_MAP.md.
.agents/skills/check-conventions/SKILL.md Adds a “check-conventions” skill doc encoding hard project rules.
.agents/agents/testing.md Updates testing agent guidance (prefers real downloaded fixtures; clarifies commands).
.agents/agents/implementation.md Updates implementation agent rules (LPS convention, no-emoji, ConvertVTKToUSD, etc.).
.agents/agents/architecture.md Updates architecture invariants (LPS internal frame; USD export conversion).

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

Comment thread src/physiomotion4d/register_time_series_images.py Outdated
Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/test-slow.yml
Comment thread .github/workflows/nightly-health.yml
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

❌ Patch coverage is 5.66038% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 31.13%. Comparing base (7c9a379) to head (0dd3344).

Files with missing lines Patch % Lines
src/physiomotion4d/register_time_series_images.py 5.66% 50 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #60      +/-   ##
==========================================
- Coverage   31.22%   31.13%   -0.10%     
==========================================
  Files          50       50              
  Lines        6828     6861      +33     
==========================================
+ Hits         2132     2136       +4     
- Misses       4696     4725      +29     
Flag Coverage Δ
integration-tests 31.01% <5.66%> (?)
unittests 31.11% <5.66%> (-0.11%) ⬇️

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.

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: 6

🧹 Nitpick comments (3)
tests/test_register_time_series_images.py (1)

57-72: ⚡ Quick win

Add one behavior test for combined-mode initial-transform propagation

The new tests validate construction and iteration state, but they don’t cover the new combined execution path. Add a focused test for greedy_icon/ants_icon asserting that an initial_forward_transform is propagated through the initial stage.

Also applies to: 109-115

🤖 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 `@tests/test_register_time_series_images.py` around lines 57 - 72, Add a new
behavior test that constructs RegisterTimeSeriesImages with the combined modes
"greedy_icon" and "ants_icon", set a sentinel value on the initial-stage
registrar's initial_forward_transform (e.g.,
registrar.registrar_greedy.initial_forward_transform or
registrar.registrar_ants.initial_forward_transform), and assert that after
initialization the downstream ICON registrar
(registrar.registrar_icon.initial_forward_transform) equals that sentinel; this
verifies the initial_forward_transform is propagated from the initial registrar
to the ICON stage in combined-mode.
.agents/skills/check-conventions/SKILL.md (1)

67-69: ⚡ Quick win

Add language specifier to fenced code block.

The example output format block should specify a language for proper rendering. Since this is showing example terminal output, use text or console.

📝 Proposed fix
-```
+```text
 <path>:<line>  <rule short name>  <one-line excerpt>
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

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

In @.agents/skills/check-conventions/SKILL.md around lines 67 - 69, The fenced
code block example in .agents/skills/check-conventions/SKILL.md that shows
": " is missing a language
specifier; update the triple-backtick block to include a language like text
(e.g., change totext) so the example terminal output renders correctly.


</details>

</blockquote></details>
<details>
<summary>AGENTS.md (1)</summary><blockquote>

`98-108`: _⚡ Quick win_

**Consider whether this Codex-specific troubleshooting belongs in shared contributor guidance.**

The "Codex Sandbox" section documents a workaround for a single user's environment (`C:\Users\saylward\...`). This is very specific and may not apply to other contributors. Consider either:
- Generalizing this section to cover common sandbox path issues without hardcoded user paths, or
- Moving this guidance to a Codex-specific troubleshooting doc, or
- Removing it if it's a temporary workaround

The current wording makes `AGENTS.md` read like a personal troubleshooting log rather than universal contributor guidance.

<details>
<summary>🤖 Prompt for AI Agents</summary>

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

In `@AGENTS.md` around lines 98 - 108, The "Codex Sandbox" section in AGENTS.md
contains a user-specific workaround (hardcoded paths like the temporary venv
path `C:\Users\saylward\AppData\Local\Temp\pm4d-uv-env\Scripts\python.exe`) that
doesn't belong in shared contributor guidance; either generalize the guidance to
describe symptoms and a generic workaround for broken launcher/venv paths
without personal paths, or move this content into a Codex-specific
troubleshooting doc (or remove it if temporary), and update the section title
"Codex Sandbox" and its bullet points to reflect the chosen option.
```

</details>

</blockquote></details>

</blockquote></details>

<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>

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 @.github/workflows/ci.yml:

  • Around line 305-311: The GPU job is creating a venv with Python 3.10 but then
    tries to install the physicsnemo extra which requires Python >=3.11; update the
    workflow so the interpreter matches the package requirement by changing the
    runner/venv Python version to 3.11 (or, alternatively, remove the physicsnemo
    extra from the pip install command) — specifically update the job setup that
    creates the venv and the pip invocation that runs python -m uv pip install -e
    ".[test,cuda13,physicsnemo]" so the Python used for python -m uv is 3.11 (or
    drop ",physicsnemo" from the extras if you prefer not to require 3.11).

In @.github/workflows/README.md:

  • Around line 147-153: The README currently shows the install command uv pip
    install -e ".[test,cuda13,physicsnemo]" but omits that the physicsnemo extra
    pulls in nvidia-physicsnemo which requires Python >= 3.11; update both
    occurrences of uv pip install -e ".[test,cuda13,physicsnemo]" to include a short
    note like “(requires Python >= 3.11)” immediately adjacent to the command so
    users on Python 3.10 see the prerequisite before attempting installation.

In @docs/contributing.rst:

  • Around line 270-273: Update the comment next to the pytest command that
    mentions the physicsnemo extra to specify the Python minimum, i.e., change the
    comment on the line containing "pytest tests/ --run-physicsnemo" (the pytest
    command shown in the diff) to read that it needs the [physicsnemo] extra and
    Python >= 3.11 (for example: "# needs [physicsnemo] extra installed; requires
    Python >= 3.11").

In @src/physiomotion4d/register_time_series_images.py:

  • Around line 798-809: The forwarded initial_forward_transform argument is being
    dropped when delegating to the internal registrars: when
    self.registration_method_name is "ants_icon" or "greedy_icon" you call
    registrar_initial.registration_method(...) but do not pass through the
    initial_forward_transform; likewise pass it through in the later call that
    invokes self.registrar_ants/registrar_greedy (the other block around lines
    816-817). Fix by adding the initial_forward_transform=initial_forward_transform
    (or the public parameter name) to the keyword args when calling
    registrar_initial.registration_method and to the subsequent
    registrar_*.registration_method calls so the initial transform is preserved
    (references: self.registration_method_name, registrar_initial,
    self.registrar_ants.registration_method,
    self.registrar_greedy.registration_method, initial_res).
  • Line 22: The module-level constant REGISTRATION_METHODS lacks an explicit type
    annotation; add a precise type (e.g., List[str] or Sequence[str]) to its
    declaration and import the corresponding typing symbol (from typing import List
    or Sequence) at the top of the module so the constant is declared with an
    explicit type like REGISTRATION_METHODS: List[str] = [...] to satisfy strict
    typing.

In @tests/test_register_time_series_images.py:

  • Line 71: Remove the noisy print statement print("\nTime series registrar
    initialized with Greedy") from tests/test_register_time_series_images.py; if you
    need to record that information for debugging replace it with the logging module
    (e.g., logger.debug/ info) or rely on pytest's caplog fixture, ensuring no
    direct print() calls remain in the test.

Nitpick comments:
In @.agents/skills/check-conventions/SKILL.md:

  • Around line 67-69: The fenced code block example in
    .agents/skills/check-conventions/SKILL.md that shows ": " is missing a language specifier; update the
    triple-backtick block to include a language like text (e.g., change ``` to

In `@AGENTS.md`:
- Around line 98-108: The "Codex Sandbox" section in AGENTS.md contains a
user-specific workaround (hardcoded paths like the temporary venv path
`C:\Users\saylward\AppData\Local\Temp\pm4d-uv-env\Scripts\python.exe`) that
doesn't belong in shared contributor guidance; either generalize the guidance to
describe symptoms and a generic workaround for broken launcher/venv paths
without personal paths, or move this content into a Codex-specific
troubleshooting doc (or remove it if temporary), and update the section title
"Codex Sandbox" and its bullet points to reflect the chosen option.

In `@tests/test_register_time_series_images.py`:
- Around line 57-72: Add a new behavior test that constructs
RegisterTimeSeriesImages with the combined modes "greedy_icon" and "ants_icon",
set a sentinel value on the initial-stage registrar's initial_forward_transform
(e.g., registrar.registrar_greedy.initial_forward_transform or
registrar.registrar_ants.initial_forward_transform), and assert that after
initialization the downstream ICON registrar
(registrar.registrar_icon.initial_forward_transform) equals that sentinel; this
verifies the initial_forward_transform is propagated from the initial registrar
to the ICON stage in combined-mode.
🪄 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: 84682737-b7ae-40bf-b169-d209baa88ce2

📥 Commits

Reviewing files that changed from the base of the PR and between 7c9a379 and c9f3151.

📒 Files selected for processing (29)
  • .agents/agents/architecture.md
  • .agents/agents/implementation.md
  • .agents/agents/testing.md
  • .agents/skills/check-conventions/SKILL.md
  • .agents/skills/regen-api-map/SKILL.md
  • .agents/skills/review-pr/SKILL.md
  • .github/workflows/README.md
  • .github/workflows/ci.yml
  • .github/workflows/nightly-health.yml
  • .github/workflows/test-slow.yml
  • .gitignore
  • AGENTS.md
  • CLAUDE.md
  • README.md
  • docs/API_MAP.md
  • docs/api/registration/time_series.rst
  • docs/contributing.rst
  • docs/developer/core.rst
  • docs/quickstart.rst
  • docs/testing.rst
  • docs/tutorials.rst
  • pyproject.toml
  • src/physiomotion4d/register_time_series_images.py
  • tests/README.md
  • tests/conftest.py
  • tests/test_register_time_series_images.py
  • tutorials/README.md
  • tutorials/tutorial_09_physicsnemo_mesh_stage_model.py
  • utils/ai_agent_github_reviews.py

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/README.md Outdated
Comment thread docs/contributing.rst Outdated
Comment thread src/physiomotion4d/register_time_series_images.py Outdated
Comment thread src/physiomotion4d/register_time_series_images.py
Comment thread tests/test_register_time_series_images.py
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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.gitignore:
- Around line 20-22: The .gitignore contains a misspelled pattern
".github_reveiw_prompt.txt" which doesn't match the actual generated file;
update the .gitignore to replace the incorrect entry with the correct
".github_review_prompt.txt" (remove or fix the misspelled
".github_reveiw_prompt.txt") so the intermediate prompt produced by the script
is properly ignored.
🪄 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: 379612e1-22b2-4ca0-8c8d-5f7aba80e1f0

📥 Commits

Reviewing files that changed from the base of the PR and between c9f3151 and e1adcc0.

📒 Files selected for processing (11)
  • .agents/skills/check-conventions/SKILL.md
  • .agents/skills/review-pr/SKILL.md
  • .github/workflows/README.md
  • .github/workflows/ci.yml
  • .github/workflows/nightly-health.yml
  • .github/workflows/test-slow.yml
  • .gitignore
  • docs/API_MAP.md
  • docs/contributing.rst
  • src/physiomotion4d/register_time_series_images.py
  • utils/ai_agent_github_reviews.py
✅ Files skipped from review due to trivial changes (2)
  • docs/contributing.rst
  • docs/API_MAP.md

Comment thread .gitignore
Copilot AI review requested due to automatic review settings May 23, 2026 16:44
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 28 out of 29 changed files in this pull request and generated 2 comments.

Comment thread tests/conftest.py
"--run-all",
action="store_true",
default=False,
help=("Enable every --run-* bucket: " + ", ".join(_RUN_BUCKET_FLAGS) + "."),
)

print("\nTime series registrar initialized with Greedy")

@aylward aylward merged commit 36d752a into Project-MONAI:main May 23, 2026
10 of 12 checks passed
@aylward aylward deleted the physicsnemooptional branch May 23, 2026 17:59
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