Skip to content

Commit a291bbf

Browse files
authored
ENH: image and transform baselines and experiment notebook testing (#26)
* ENH: image and transform baseline testing and experiment notebook test support - Add TestTools (test_tools.py): compare 2D/3D image slices and ITK transforms to baselines with configurable tolerances; ITK .mha I/O - Add notebook_utils.running_as_test() for reduced params when run via pytest - Add --run-experiments flag, experiment marker, and tests/baselines - Use TestTools in test_register_time_series_images for image and transform comparison - Update experiment notebooks and test docs (EXPERIMENT_FLAG_USAGE, EXPERIMENT_TESTS_GUIDE) * Add baseline comparison tests for time-series image registration - TestTools: compare_result_to_baseline_transform and compare_result_to_baseline_image - TestRegisterTimeSeriesImages: baseline .hdf transforms and .mha images - pytest --create-baselines support; CI and test docs updated
1 parent 2e4f6a6 commit a291bbf

55 files changed

Lines changed: 2697 additions & 1943 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.

.cursor/rules/project-standards.mdc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,7 @@ The user prefers to review and stage changes manually.
100100
- Make atomic commits with clear messages
101101
- Don't commit large binary files (add to `.gitignore`)
102102
- Use `git status` to verify changes before committing
103+
104+
**Code and documentation versions:**
105+
- Refer to code and documentation in the folder reference_code to get examples and documentation of the APIs and best practices for the advanced libraries used in this project:
106+
- ITK, VTK, PyVista, Omniverse, PhysicsNeMo, Simpleware, MONAI, and OpenUSD

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.hdf filter=lfs diff=lfs merge=lfs -text
2+
*.mha filter=lfs diff=lfs merge=lfs -text

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
steps:
3636
- name: Checkout code
3737
uses: actions/checkout@v4
38+
with:
39+
lfs: true
3840

3941
- name: Free up disk space on Ubuntu
4042
if: matrix.os == 'ubuntu-latest'
@@ -134,6 +136,8 @@ jobs:
134136
steps:
135137
- name: Checkout code
136138
uses: actions/checkout@v4
139+
with:
140+
lfs: true
137141

138142
- name: Free up disk space
139143
run: |
@@ -264,6 +268,8 @@ jobs:
264268
steps:
265269
- name: Checkout code
266270
uses: actions/checkout@v4
271+
with:
272+
lfs: true
267273

268274
- name: Set up Python ${{ matrix.python-version }}
269275
uses: actions/setup-python@v5
@@ -341,6 +347,8 @@ jobs:
341347
steps:
342348
- name: Checkout code
343349
uses: actions/checkout@v4
350+
with:
351+
lfs: true
344352

345353
- name: Set up Python 3.10
346354
uses: actions/setup-python@v5

.github/workflows/test-slow.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
steps:
1818
- name: Checkout code
1919
uses: actions/checkout@v4
20+
with:
21+
lfs: true
2022

2123
- name: Set up Python 3.10
2224
uses: actions/setup-python@v5

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ network_weights
2424
# Data files
2525
*.gz
2626
*.mat
27-
*.mha
2827
*.mhd
2928
*.zip
3029
*.nii

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ PhysioMotion4D is a comprehensive medical imaging package that converts 4D CT sc
2929
- NVIDIA GPU with CUDA 12.6+ (for AI models and registration)
3030
- 16GB+ RAM (32GB+ recommended for large datasets)
3131
- NVIDIA Omniverse (for USD visualization)
32+
- **Git LFS** (required for running tests: baseline files in `tests/baselines/` are stored with Git LFS; install from [git-lfs.github.com](https://git-lfs.github.com), then run `git lfs install` and `git lfs pull` after cloning)
3233

3334
### Installation from PyPI
3435

@@ -43,10 +44,12 @@ pip install physiomotion4d[nim]
4344

4445
### Installation from Source
4546

46-
1. **Clone the repository**:
47+
1. **Clone the repository** (Git LFS is required for tests; install it first from [git-lfs.github.com](https://git-lfs.github.com)):
4748
```bash
4849
git clone <repository-url>
4950
cd PhysioMotion4D
51+
git lfs install # if not already done
52+
git lfs pull # fetch .hdf and .mha baselines in tests/baselines/
5053
```
5154

5255
2. **Create virtual environment**:

data/KCL-Heart-Model/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
training_cases*
22
pca*
33
surfaces*
4+
labelmap*

data/Slicer-Heart-CT/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.mha

experiments/Colormap-VTK_To_USD/colormap_vtk_to_usd.ipynb

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
"execution_count": null,
3535
"metadata": {
3636
"execution": {
37-
"iopub.execute_input": "2026-02-04T01:32:18.383455Z",
38-
"iopub.status.busy": "2026-02-04T01:32:18.382880Z",
39-
"iopub.status.idle": "2026-02-04T01:32:33.026051Z",
40-
"shell.execute_reply": "2026-02-04T01:32:33.025056Z"
37+
"iopub.execute_input": "2026-02-09T03:48:28.123883Z",
38+
"iopub.status.busy": "2026-02-09T03:48:28.123883Z",
39+
"iopub.status.idle": "2026-02-09T03:48:43.826000Z",
40+
"shell.execute_reply": "2026-02-09T03:48:43.825409Z"
4141
}
4242
},
4343
"outputs": [],
@@ -72,10 +72,10 @@
7272
"execution_count": null,
7373
"metadata": {
7474
"execution": {
75-
"iopub.execute_input": "2026-02-04T01:32:33.041069Z",
76-
"iopub.status.busy": "2026-02-04T01:32:33.041069Z",
77-
"iopub.status.idle": "2026-02-04T01:32:33.056057Z",
78-
"shell.execute_reply": "2026-02-04T01:32:33.055050Z"
75+
"iopub.execute_input": "2026-02-09T03:48:43.846529Z",
76+
"iopub.status.busy": "2026-02-09T03:48:43.846034Z",
77+
"iopub.status.idle": "2026-02-09T03:48:43.857215Z",
78+
"shell.execute_reply": "2026-02-09T03:48:43.856121Z"
7979
}
8080
},
8181
"outputs": [],
@@ -130,10 +130,10 @@
130130
"execution_count": null,
131131
"metadata": {
132132
"execution": {
133-
"iopub.execute_input": "2026-02-04T01:32:33.057059Z",
134-
"iopub.status.busy": "2026-02-04T01:32:33.057059Z",
135-
"iopub.status.idle": "2026-02-04T01:32:33.220731Z",
136-
"shell.execute_reply": "2026-02-04T01:32:33.219708Z"
133+
"iopub.execute_input": "2026-02-09T03:48:43.858745Z",
134+
"iopub.status.busy": "2026-02-09T03:48:43.858745Z",
135+
"iopub.status.idle": "2026-02-09T03:48:44.022573Z",
136+
"shell.execute_reply": "2026-02-09T03:48:44.021580Z"
137137
}
138138
},
139139
"outputs": [],
@@ -182,10 +182,10 @@
182182
"execution_count": null,
183183
"metadata": {
184184
"execution": {
185-
"iopub.execute_input": "2026-02-04T01:32:33.222706Z",
186-
"iopub.status.busy": "2026-02-04T01:32:33.221699Z",
187-
"iopub.status.idle": "2026-02-04T01:32:33.355566Z",
188-
"shell.execute_reply": "2026-02-04T01:32:33.354562Z"
185+
"iopub.execute_input": "2026-02-09T03:48:44.024575Z",
186+
"iopub.status.busy": "2026-02-09T03:48:44.024575Z",
187+
"iopub.status.idle": "2026-02-09T03:48:44.158618Z",
188+
"shell.execute_reply": "2026-02-09T03:48:44.157624Z"
189189
}
190190
},
191191
"outputs": [],
@@ -224,10 +224,10 @@
224224
"execution_count": null,
225225
"metadata": {
226226
"execution": {
227-
"iopub.execute_input": "2026-02-04T01:32:33.356562Z",
228-
"iopub.status.busy": "2026-02-04T01:32:33.356562Z",
229-
"iopub.status.idle": "2026-02-04T01:32:33.492011Z",
230-
"shell.execute_reply": "2026-02-04T01:32:33.490997Z"
227+
"iopub.execute_input": "2026-02-09T03:48:44.159626Z",
228+
"iopub.status.busy": "2026-02-09T03:48:44.159626Z",
229+
"iopub.status.idle": "2026-02-09T03:48:44.293616Z",
230+
"shell.execute_reply": "2026-02-09T03:48:44.292622Z"
231231
}
232232
},
233233
"outputs": [],
@@ -266,10 +266,10 @@
266266
"execution_count": null,
267267
"metadata": {
268268
"execution": {
269-
"iopub.execute_input": "2026-02-04T01:32:33.494019Z",
270-
"iopub.status.busy": "2026-02-04T01:32:33.494019Z",
271-
"iopub.status.idle": "2026-02-04T01:32:33.627873Z",
272-
"shell.execute_reply": "2026-02-04T01:32:33.626854Z"
269+
"iopub.execute_input": "2026-02-09T03:48:44.295616Z",
270+
"iopub.status.busy": "2026-02-09T03:48:44.295616Z",
271+
"iopub.status.idle": "2026-02-09T03:48:44.428154Z",
272+
"shell.execute_reply": "2026-02-09T03:48:44.428154Z"
273273
}
274274
},
275275
"outputs": [],
@@ -308,10 +308,10 @@
308308
"execution_count": null,
309309
"metadata": {
310310
"execution": {
311-
"iopub.execute_input": "2026-02-04T01:32:33.629849Z",
312-
"iopub.status.busy": "2026-02-04T01:32:33.629849Z",
313-
"iopub.status.idle": "2026-02-04T01:32:33.764342Z",
314-
"shell.execute_reply": "2026-02-04T01:32:33.763320Z"
311+
"iopub.execute_input": "2026-02-09T03:48:44.430154Z",
312+
"iopub.status.busy": "2026-02-09T03:48:44.430154Z",
313+
"iopub.status.idle": "2026-02-09T03:48:44.563163Z",
314+
"shell.execute_reply": "2026-02-09T03:48:44.563163Z"
315315
}
316316
},
317317
"outputs": [],
@@ -348,10 +348,10 @@
348348
"execution_count": null,
349349
"metadata": {
350350
"execution": {
351-
"iopub.execute_input": "2026-02-04T01:32:33.766328Z",
352-
"iopub.status.busy": "2026-02-04T01:32:33.766328Z",
353-
"iopub.status.idle": "2026-02-04T01:32:33.900294Z",
354-
"shell.execute_reply": "2026-02-04T01:32:33.899437Z"
351+
"iopub.execute_input": "2026-02-09T03:48:44.565157Z",
352+
"iopub.status.busy": "2026-02-09T03:48:44.565157Z",
353+
"iopub.status.idle": "2026-02-09T03:48:44.699684Z",
354+
"shell.execute_reply": "2026-02-09T03:48:44.698691Z"
355355
}
356356
},
357357
"outputs": [],
@@ -394,10 +394,10 @@
394394
"execution_count": null,
395395
"metadata": {
396396
"execution": {
397-
"iopub.execute_input": "2026-02-04T01:32:33.903321Z",
398-
"iopub.status.busy": "2026-02-04T01:32:33.902378Z",
399-
"iopub.status.idle": "2026-02-04T01:32:34.035124Z",
400-
"shell.execute_reply": "2026-02-04T01:32:34.034169Z"
397+
"iopub.execute_input": "2026-02-09T03:48:44.701683Z",
398+
"iopub.status.busy": "2026-02-09T03:48:44.701683Z",
399+
"iopub.status.idle": "2026-02-09T03:48:44.834684Z",
400+
"shell.execute_reply": "2026-02-09T03:48:44.833694Z"
401401
}
402402
},
403403
"outputs": [],
@@ -458,10 +458,10 @@
458458
"execution_count": null,
459459
"metadata": {
460460
"execution": {
461-
"iopub.execute_input": "2026-02-04T01:32:34.037115Z",
462-
"iopub.status.busy": "2026-02-04T01:32:34.037115Z",
463-
"iopub.status.idle": "2026-02-04T01:32:34.050245Z",
464-
"shell.execute_reply": "2026-02-04T01:32:34.049224Z"
461+
"iopub.execute_input": "2026-02-09T03:48:44.836684Z",
462+
"iopub.status.busy": "2026-02-09T03:48:44.835685Z",
463+
"iopub.status.idle": "2026-02-09T03:48:44.849686Z",
464+
"shell.execute_reply": "2026-02-09T03:48:44.848691Z"
465465
}
466466
},
467467
"outputs": [],

0 commit comments

Comments
 (0)