You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ENH: HeartSimplewareTrimmedBranches + opt-in test marker overhaul (#53)
* ENH: Add HeartSimplewareTrimmedBranches as a segmentation option
Default method for work involving KCL heart data
* ENH: Gate slow/GPU/Simpleware tests behind --run-* flags
- Add --run-slow, --run-gpu, --run-simpleware pytest flags;
collection-hook auto-skips the matching markers unless the flag is
passed. Mirrors the pre-existing --run-experiments / --run-tutorials
pattern.
- Retire the requires_data marker: 29 decorator lines removed across 17
test files. Tests that need downloadable data request the session
fixtures (test_directories, download_test_data, test_images) and the
data is fetched on first use.
- Mark TestRegisterImagesICON, TestSegmentHeartSimpleware, and
TestSegmentChestTotalSegmentator with requires_gpu so they fall into
the new --run-gpu bucket.
- Update self-hosted GPU workflows (ci.yml gpu-tests, test-slow.yml,
nightly-health.yml) to pass every opt-in flag
(--run-gpu --run-slow --run-simpleware --run-experiments
--run-tutorials). Tests whose host requirements aren't met (e.g. a
licensed Simpleware install) runtime-skip cleanly.
- Add three unit tests to test_workflow_fit_statistical_model_to_patient
covering the new HeartSimplewareTrimmedBranches default and the
WorkflowConvertImageToVTK dispatch path.
- Update documentation throughout (CLAUDE.md, AGENTS.md, README.md,
tests/README.md, docs/testing.rst, docs/contributing.rst,
docs/developer/{core,extending,segmentation}.rst,
docs/api/segmentation/base.rst, .agents/agents/testing.md,
.agents/skills/test-feature/SKILL.md). The test-feature skill and
AGENTS.md testing role now strongly prefer real (downloaded) test
data with baseline comparison over synthetic data.
* ENH: Document HeartSimpleware behavior change; harden USD dispatch
Address PR #53 review feedback:
- Add a "Behavior change" note to the WorkflowConvertImageToVTK and
WorkflowConvertImageToUSD class docstrings warning that the
'HeartSimpleware' option no longer implicitly trims branches; callers
that want trimming should now select 'HeartSimplewareTrimmedBranches'.
- Replace the silent else: branch in
WorkflowConvertImageToUSD.__init__ with an explicit
elif self.segmentation_method in (...) plus else: raise ValueError(...),
matching the dispatch shape in WorkflowConvertImageToVTK._create_segmenter
so a future fourth option cannot silently behave like HeartSimpleware.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
description: Inspect a PhysioMotion4D implementation and its existing tests, propose a synthetic-data test plan, then create or update pytest tests. Explains how to run them.
2
+
description: Inspect a PhysioMotion4D implementation and its existing tests, propose a real-data-driven test plan with baseline comparisons, then create or update pytest tests. Explains how to run them.
3
3
---
4
4
5
5
Write or update tests for the following in PhysioMotion4D:
@@ -9,10 +9,38 @@ $ARGUMENTS
9
9
Instructions:
10
10
1. Read the implementation file(s) to understand the public interface.
11
11
2. Read the existing test file for this module if one exists (e.g. `tests/test_<module>.py`).
12
-
3. Propose a test plan: list the behaviors to cover and the synthetic data to create.
13
-
4. Implement tests using synthetic `itk.Image` objects (32–64 voxels/side) or small
14
-
`pv.PolyData` surfaces — not real patient data.
15
-
5. State image shape and axis order in every test docstring.
16
-
6. Mark any test that genuinely requires real data with `@pytest.mark.requires_data`.
17
-
7. Show the exact command to run the new tests:
18
-
`py -m pytest tests/test_<module>.py -v`
12
+
3. Propose a test plan: list the behaviors to cover and the inputs each behavior
13
+
needs.
14
+
4.**Strongly prefer real (downloaded) test data over synthetic data.** Request
15
+
the session fixtures (`test_directories`, `download_test_data`,
16
+
`test_images`) so the standard test datasets are pulled automatically on
17
+
first use. Real data exercises the production code paths — preprocessing,
18
+
resampling, dtype handling, world-frame metadata — that synthetic toy
19
+
volumes silently bypass. Only fall back to synthetic `itk.Image` or
20
+
`pv.PolyData` inputs when:
21
+
- the behavior under test is a pure unit (e.g. axis arithmetic, dict
22
+
routing) where real data adds no signal, or
23
+
- real data would push the test into a slow / GPU / Simpleware bucket
24
+
that doesn't fit the test's purpose.
25
+
When using synthetic inputs anyway, keep volumes ≤64 voxels per side and
26
+
say so in the docstring.
27
+
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
29
+
than ad-hoc value assertions. Store baselines under `tests/baselines/`
30
+
(Git LFS-tracked). Run with `--create-baselines` to materialize missing
31
+
baselines on first use; afterward, regression compares to the stored
32
+
baseline. This catches drift that hand-written numeric thresholds miss.
33
+
6. State image shape and axis order in every test docstring (e.g.
34
+
`"""...image shape: (X, Y, Z, T) = (64, 64, 32, 1), LPS world frame."""`).
35
+
7. Mark tests that need a GPU, a slow runtime, or a licensed Simpleware
36
+
install with `@pytest.mark.requires_gpu`, `@pytest.mark.slow`, or
37
+
`@pytest.mark.requires_simpleware` so they fall into the right opt-in
38
+
bucket (`--run-gpu`, `--run-slow`, `--run-simpleware`). Tests that just
39
+
need downloadable data need **no** marker — the fixture chain handles it.
40
+
8. Show the exact command to run the new tests, including any opt-in flags
0 commit comments