Commit 2c9ffa7
authored
ENH: AnatomyTaxonomy, USD pipeline hardening, tutorials + docs (#49)
* ENH: AnatomyTaxonomy, USD pipeline hardening, tutorials + docs
Replaces the per-organ flat dicts on SegmentAnatomyBase and USDAnatomyTools
with a shared AnatomyTaxonomy data type so new segmenters can register
custom groups via taxonomy.add_organ without subclassing either class.
Adds anatomy-type grouping to ConvertVTKToUSD's labeled output, ships
tutorials 07-09 (DirLab PCA + PhysicsNeMo), and fixes several USD-
pipeline issues that prevented clean rendering in Omniverse Kit.
Anatomy / segmentation
- AnatomyTaxonomy + AnatomyGroup (new). SegmentAnatomyBase owns one;
subclasses populate via taxonomy.add_organ and call
_finalize_other_group. Eight legacy *_mask_ids attributes and
set_other_and_all_mask_ids removed; label_to_type delegates to the
taxonomy. segment() now returns only the groups the segmenter
registered (caller-checks contract; tests updated).
- SegmentHeartSimpleware: graceful fallback when ASCardio omits
landmarks.csv; only the groups it actually populates are returned.
USD generation
- ConvertVTKToUSD: new segmenter= parameter groups labeled prims under
/World/{basename}/{type}/{label} and materials under
/World/Looks/{type}/{label}_material. Preserves cell-data primvars;
new compute_von_mises_stress helper for 9-component stress tensors;
framing camera with tight near-clip; stale USD-layer eviction;
triangulation face-map propagated to uniform primvars so per-cell
arrays survive quad-to-triangle splits.
- USDAnatomyTools: DEFAULT_RENDER_PARAMS promoted to a module-level
constant so CLIs/tests can enumerate types without a stage; per-
instance deep copy keeps mutations isolated; enhance_meshes now a
single taxonomy loop with organ-level overrides as data instead of
imperative carve-outs. MaterialBindingAPI.Apply() so Omniverse RTX
consumes the binding (was rendering white).
- CLI convert_vtk_to_usd: ANATOMY_TYPES sourced from
DEFAULT_RENDER_PARAMS (auto-syncs with future additions); "kidney"
alias preserved.
Tutorials / experiments
- Tutorials 07-09 added (DirLab PCA lung-lobe model, time-series
propagation, PhysicsNeMo mesh-stage training).
- Tutorials 02-09 gain if __name__ == "__main__" guards (Windows
nnUNet spawn) matching tutorial_01; experiments gain the same
guards plus Path(__file__)-anchored paths; valve scripts wire
compute_von_mises_stress.
- notebook_utils.py removed (last consumers gone); experiment scripts
and READMEs scrubbed of .ipynb references; test runner already on
*.py glob.
Tests, docs, packaging
- New test_anatomy_taxonomy (12 tests); mask_ids / Simpleware
assertions updated to the caller-checks contract; tutorial test
harness rewritten.
- Segmentation .rst pages, developer/segmentation.rst, and developer/
usd_generation.rst updated to document AnatomyTaxonomy, the
type-grouped layout, von Mises helper, framing camera, and the
three ways to register a new group's look.
- New CLI .rst pages, simpleware/greedy API pages, vtk_to_usd_lib
page, data_download / test_tools utility pages; API_MAP.md
regenerated.
- mypy: 7 errors fixed (Optional render-params indexing, redundant
np.asarray casts, pyvista Plotter binding via Any cast,
matplotlib colormap return typing). Full src/ tree clean.
Other
- data_download_tools.py extracted (was notebook_utils.py glue).
- pyproject.toml mypy overrides tightened.
- Stale baseline PNGs removed (regenerated by test_tools at runtime).
* COMP: Bump CI to Python 3.11. 3.10 is no longer supported.
* ENH: PR review fixes, save_3d_images split, USD utils, deps
save_3d_images: split the single basename argument into (directory,
basename); create the directory if needed. Propagated to all 7 callers
across src/, tests/, experiments/, data/Slicer-Heart-CT, and the
gated-CT workflow.
USDTools: move the module-level load_openusd_as_vtk and
_openusd_display_color helpers onto USDTools as load_usd_as_vtk and
_usd_display_color; update test_tools and test_vtk_to_usd_library
callers.
Tutorial outputs unified under TUTORIALS_DIR / "output" / ... so
tutorials 01/07/08/09 agree with tests/test_tutorials.py.
tutorial_01: drop the stray "test_mode = True" override so
TestTools.running_as_test() actually drives data_dir selection and
registration iteration count.
tutorial_08: validate phase_files, forward_transforms, and
inverse_transforms have equal length and raise ValueError on mismatch
before zipping so dropped frames surface instead of truncating
silently.
experiments/Heart-GatedCT_To_USD/3: move TestTools.running_as_test()
inside the __main__ guard so behavior matches the defensive
Windows-spawn comment.
vtk_to_usd/usd_utils.add_framing_camera: pick the camera offset axis
perpendicular to the stage up axis (+Y for Z-up stages, +Z otherwise)
so Z-up stages frame correctly.
Bump pyvista[all] floor: >=0.43.0 -> >=0.47.0.
Drop legacy Verity{SlicerHeartCT,KCLHeartModel}Data typo shims in
data_download_tools; current code only uses Verify* spellings.
docs/api/cli/index.rst: fix "an main() function" -> "a main() function".
docs/contributing.rst: drop the now-obsolete "If users might copy your
code..." paragraph.
docs/API_MAP.md regenerated.
* ENH: Enable offscreen rendering in github CI runners.
* ENH: No offscreen rendering on windows, disable certain tests
* ENH: Simplify results and baseline paths for tests
* BUG: Camera should point to center of bbox
* BUG: Ensure download goes to unique tmp file
* DOC: Cleanup doc mentions of notebook
* DOC: Remove reference to notebook/ipynb and emojis
* DOC: Minor doc fixes1 parent 533d0da commit 2c9ffa7
138 files changed
Lines changed: 6259 additions & 4593 deletions
File tree
- .agents
- .github/workflows
- data
- KCL-Heart-Model
- Slicer-Heart-CT
- test
- docs
- api
- cli
- model_registration
- registration
- segmentation
- usd
- utilities
- cli_scripts
- developer
- experiments
- Colormap-VTK_To_USD
- Convert_VTK_To_USD
- Heart-Create_Statistical_Model
- Heart-GatedCT_To_USD
- Heart-Simpleware_Segmentation
- Heart-Statistical_Model_To_Patient
- Heart-VTKSeries_To_USD
- Lung-GatedCT_To_USD
- Reconstruct4DCT
- src/physiomotion4d
- cli
- simpleware_medical
- vtk_to_usd
- tests
- baselines
- tutorial_01_heart_gated_ct_to_usd
- tutorial_02_ct_to_vtk
- tutorial_05_vtk_to_usd
- tutorials
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
| |||
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
102 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
103 | 112 | | |
104 | 113 | | |
105 | 114 | | |
106 | 115 | | |
107 | 116 | | |
108 | | - | |
| 117 | + | |
109 | 118 | | |
110 | 119 | | |
111 | 120 | | |
| |||
115 | 124 | | |
116 | 125 | | |
117 | 126 | | |
118 | | - | |
| 127 | + | |
119 | 128 | | |
120 | 129 | | |
121 | 130 | | |
| |||
148 | 157 | | |
149 | 158 | | |
150 | 159 | | |
151 | | - | |
| 160 | + | |
152 | 161 | | |
153 | 162 | | |
154 | | - | |
| 163 | + | |
155 | 164 | | |
156 | 165 | | |
157 | 166 | | |
| |||
185 | 194 | | |
186 | 195 | | |
187 | 196 | | |
188 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
189 | 200 | | |
190 | 201 | | |
191 | 202 | | |
| |||
218 | 229 | | |
219 | 230 | | |
220 | 231 | | |
221 | | - | |
| 232 | + | |
| 233 | + | |
222 | 234 | | |
223 | 235 | | |
224 | 236 | | |
225 | 237 | | |
226 | | - | |
| 238 | + | |
| 239 | + | |
227 | 240 | | |
228 | 241 | | |
229 | 242 | | |
230 | 243 | | |
231 | | - | |
| 244 | + | |
| 245 | + | |
232 | 246 | | |
233 | 247 | | |
234 | 248 | | |
| |||
345 | 359 | | |
346 | 360 | | |
347 | 361 | | |
348 | | - | |
| 362 | + | |
349 | 363 | | |
350 | 364 | | |
351 | | - | |
| 365 | + | |
352 | 366 | | |
353 | 367 | | |
354 | 368 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
0 commit comments