Skip to content

Commit 60baec7

Browse files
authored
ENH: Rename *_tools modules and classes to process_* naming convention (#139)
Standardize the object-first `*_tools.py`/`*Tools` naming used throughout src/monai_physio/ to the verb-first convention used elsewhere in the project (workflow_train_physicsnemo.py, register_images_ants.py, segment_chest_total_segmentator.py). contour_tools/ContourTools -> process_contours/ProcessContours, and similarly for transform, test, image, physicsnemo, usd_anatomy, usd, labelmap, and landmark tools. data_download_tools/DataDownloadTools -> download_data/ DownloadData as a naming exception. Only import paths and PascalCase class names changed; lowercase instance attributes and pytest fixtures (self.image_tools, the contour_tools fixture, etc.) are unaffected. Corresponding Sphinx API pages and toctrees were moved and retargeted to match. Adds utils/rename_tools_to_process.py, a reusable git-mv + regex migration script, and records the break in docs/developer/migration_next.md per project policy.
1 parent 2575185 commit 60baec7

211 files changed

Lines changed: 1417 additions & 1054 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/agents/architecture.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ src/monai_physio/
2222
segment_chest_*.py - TotalSegmentator, VISTA-3D, NIM, Ensemble
2323
register_images_*.py - ICON, ANTs, Greedy, time-series wrappers
2424
register_models_*.py - ICP, PCA, distance-map registerers
25-
contour_tools.py - surface extraction from ITK masks
25+
process_contours.py - surface extraction from ITK masks
2626
convert_vtk_to_usd.py - high-level VTK→USD (in-memory, PyVista)
2727
vtk_to_usd/ - file-based VTK→USD subpackage
28-
usd_tools.py / usd_anatomy_tools.py - USD stage utilities
28+
process_usd.py / process_usd_anatomy.py - USD stage utilities
2929
workflow_*.py - top-level orchestration
3030
```
3131

.agents/agents/implementation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ tutorials may require a GPU.
1919
4D CT → Segmentation → Registration → Contour Extraction → USD Export
2020

2121
Key modules: `monai_physio_base.py`, `segment_chest_*.py`, `register_images_*.py`,
22-
`register_models_*.py`, `contour_tools.py`, `convert_vtk_to_usd.py`, `vtk_to_usd/`,
22+
`register_models_*.py`, `process_contours.py`, `convert_vtk_to_usd.py`, `vtk_to_usd/`,
2323
`workflow_*.py`. Use `graphify query "<question>"` to locate classes before
2424
searching manually.
2525

.agents/agents/testing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ test off the GPU bucket.
1717

1818
- `tests/conftest.py` - session-scoped fixtures chaining: download → convert → segment → register
1919
- `tests/baselines/` - stored via Git LFS; fetch with `git lfs pull`
20-
- `src/monai_physio/test_tools.py` - baseline comparison utilities (`TestTools`)
20+
- `src/monai_physio/process_tests.py` - baseline comparison utilities (`ProcessTests`)
2121
- Markers (all opt-in via `--run-<bucket>`): `slow`, `requires_gpu`,
2222
`requires_simpleware`, `tutorial`. The `requires_data` marker
2323
no longer exists - tests that need downloadable data pull it through the
@@ -32,7 +32,7 @@ to the project interpreter. If activation is impossible, use
3232
```powershell
3333
python -m pytest tests/ -v # fast, recommended (slow/GPU/etc auto-skipped)
3434
python -m pytest tests/test_contour_tools.py -v # single file
35-
python -m pytest tests/test_contour_tools.py::TestContourTools -v # single class
35+
python -m pytest tests/test_contour_tools.py::TestProcessContours -v # single class
3636
python -m pytest tests/ -v --run-slow # opt into slow tests
3737
# typical local GPU profile; CI adds --run-simpleware --run-tutorials
3838
python -m pytest tests/ -v --run-gpu --run-slow
@@ -59,7 +59,7 @@ python -m pytest tests/ --create-baselines # create missi
5959
those are fixed conventions. State only what is specific to the test, such
6060
as the size of a synthetic volume.
6161
6. When a test produces an image or surface, compare against a baseline using
62-
`test_tools.py` utilities (`TestTools`) rather than ad-hoc value asserts.
62+
`process_tests.py` utilities (`ProcessTests`) rather than ad-hoc value asserts.
6363
Store baselines under `tests/baselines/` (Git LFS-tracked).
6464
7. Prefer images from `ROOT/data/test/slicer_heart_small`.
6565
8. Prefer storing results in subdirectories under `./results/<test_name>`.

.agents/skills/test-feature/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Instructions:
2525
When using synthetic inputs anyway, keep volumes ≤64 voxels per side and
2626
say so in the docstring.
2727
5. **When a test produces an image or surface as output, compare against a
28-
baseline** using the `test_tools.py` utilities (e.g. `TestTools`) rather
28+
baseline** using the `process_tests.py` utilities (e.g. `ProcessTests`) rather
2929
than ad-hoc value assertions. Store baselines under `tests/baselines/`
3030
(Git LFS-tracked). Run with `--create-baselines` to materialize missing
3131
baselines on first use; afterward, regression compares to the stored

.github/scripts/build_dashboard.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@
3232
import argparse
3333
import json
3434
import xml.etree.ElementTree as ET
35-
from datetime import datetime, timezone
35+
from datetime import UTC, datetime
3636
from pathlib import Path
3737

38-
3938
# ──────────────────────────────────────────────────────────────────────────────
4039
# Parsers
4140
# ──────────────────────────────────────────────────────────────────────────────
@@ -54,7 +53,7 @@ def parse_junit(xml_path: Path) -> dict:
5453
}
5554

5655
try:
57-
tree = ET.parse(xml_path) # noqa: S314
56+
tree = ET.parse(xml_path)
5857
root = tree.getroot()
5958

6059
suites = root.findall("testsuite") if root.tag == "testsuites" else [root]
@@ -401,9 +400,7 @@ def main() -> None:
401400
output_dir = Path(args.output_dir)
402401
output_dir.mkdir(parents=True, exist_ok=True)
403402

404-
timestamp = args.timestamp or datetime.now(timezone.utc).strftime(
405-
"%Y-%m-%dT%H:%M:%SZ"
406-
)
403+
timestamp = args.timestamp or datetime.now(UTC).strftime("%Y-%m-%dT%H:%M:%SZ")
407404

408405
data = {
409406
"junit": parse_junit_dir(results_dir),

.github/workflows/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,21 +197,25 @@ Tests should be marked appropriately:
197197
```python
198198
import pytest
199199

200+
200201
@pytest.mark.unit
201202
def test_simple_function():
202203
"""Fast unit test"""
203204
pass
204205

206+
205207
@pytest.mark.integration
206208
def test_full_pipeline():
207209
"""Integration test"""
208210
pass
209211

212+
210213
@pytest.mark.slow
211214
def test_long_running():
212215
"""Long-running test"""
213216
pass
214217

218+
215219
@pytest.mark.requires_gpu
216220
def test_gpu_function():
217221
"""Test requiring GPU"""

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ graphify update . # refresh after code changes (AST-only, no API c
249249
those are fixed conventions (see Data Conventions above). State only what is
250250
specific to the test, such as the size of a synthetic volume.
251251
- When a test produces an image or surface, compare against a baseline using
252-
`src/monai_physio/test_tools.py` utilities such as `TestTools`.
252+
`src/monai_physio/process_tests.py` utilities such as `ProcessTests`.
253253
- Store baselines under `tests/baselines/`, which is tracked by Git LFS. Run
254254
`git lfs pull` after cloning.
255255
- Run with `--create-baselines` to materialize missing baselines on first use.

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ came from.
156156
- Baselines in `tests/baselines/` via Git LFS - run `git lfs pull` after cloning
157157
- `tests/conftest.py`: session-scoped fixtures chaining
158158
download → convert → segment → register
159-
- `src/monai_physio/test_tools.py`: baseline comparison utilities (`TestTools`, etc.)
159+
- `src/monai_physio/process_tests.py`: baseline comparison utilities (`ProcessTests`, etc.)
160160
- Markers (all opt-in via `--run-<bucket>`): `slow`, `requires_gpu`,
161161
`requires_simpleware`, `tutorial`. Data-dependent tests no
162162
longer use a marker - they pull data through fixtures and run by default.

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ Add tests in the `tests/` directory:
228228
import pytest
229229
from monai_physio import MyNewFeature
230230

231+
231232
def test_my_feature():
232233
feature = MyNewFeature()
233234
result = feature.do_something()

data/CHOP-Valve4D/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ monai-physio-download-data CHOP-Valve4D --directory data/CHOP-Valve4D
1111
or from Python:
1212

1313
```python
14-
from monai_physio import DataDownloadTools
14+
from monai_physio import DownloadData
1515

16-
DataDownloadTools.DownloadCHOPValve4DData("data/CHOP-Valve4D")
17-
assert DataDownloadTools.VerifyCHOPValve4DData("data/CHOP-Valve4D")
16+
DownloadData.DownloadCHOPValve4DData("data/CHOP-Valve4D")
17+
assert DownloadData.VerifyCHOPValve4DData("data/CHOP-Valve4D")
1818
```
1919

2020
This downloads and extracts three zip archives attached to the

0 commit comments

Comments
 (0)