Releases: OpenHeartDevelopers/pycemrg-image-analysis
Releases · OpenHeartDevelopers/pycemrg-image-analysis
v0.1.0
Initial public release. Establishes the core anatomy pipeline, label management
tooling, ML-oriented utilities, and supporting infrastructure.
Anatomy Pipeline
MyocardiumLogic— derives myocardium masks from blood pool labels using
physical-space distance maps and configurableMyocardiumRulecontracts.
Supports multi-step application sequences (ApplicationStep) for fine-grained
control over how walls are written into the output image.ValveLogic— creates valve masks via signed-distance intersection between two
anatomical structures, driven byValveRulecontracts.RingLogic— creates pulmonary vein ring labels by combining vein distance maps
with atrium myocardium boundaries, usingRingRulecontracts.SegmentationLogic— creates cylinder masks from point clouds; used for
fibre-direction annotation and cutting plane generation.schematics/— pre-defined anatomy blueprints for LV, RV, LA, RA, valves, and
vein rings. Used as reference configurations for contract construction and
label diagnostics.recipes.py— six named end-to-end workflows:biventricular_basic,
biventricular_full,four_chamber_basic,four_chamber_full, and variants.
Each recipe is a pre-sequenced list of logic calls with fixed defaults.logic/contracts.py— all data contracts as frozen dataclasses:
MyocardiumCreationContract,ValveCreationContract,RingCreationContract,
CylinderCreationContract,ApplicationStep,MyocardiumRule,ValveRule,
RingRule.logic/builders.py—SegmentationPathBuilderconstructs contracts from
file paths and image metadata; reduces boilerplate in orchestrators.
Label Management
utilities/label_tools.py—LabelDiagnosticcompares an image's present
integer labels against a named schematic and produces aDiagnosticReport
listing missing and unexpected labels.LabelRemapperconverts a
DiagnosticReportinto an integer-to-integer mapping via
suggest_mapping_from_report().scaffolding.py—ConfigScaffoldergenerates YAML and JSON parameter files
for workflow runs.scaffold_components_with_mapping()handles the common case
where 3D Slicer has reset label values to sequential 1–N.scripts/utilities/labels_cli.py— command-line tool for inspecting label
contents and computing volume statistics from NIfTI segmentation files.
Utilities
utilities/masks.py— four mask composition modes (ADD,REPLACE,
REPLACE_ONLY,REPLACE_EXCEPT), wired throughdispatchers.py.utilities/components.py—keep_largest_component(per-label cleanup) and
keep_largest_structure(multi-label debris removal).utilities/spatial.py— point sampling on image grids, bounding-box slicing,
coordinate-system utilities.utilities/geometry.py— cylinder mask calculation in physical space.utilities/filters.py— morphological and intensity filtering helpers.utilities/io.py—load_image/save_imagewrappers; consistent spacing
and metadata handling across SimpleITK and NumPy array forms.utilities/postprocessing.py— label volume computation and related cleanup.scripts/utilities/inr_to_nifti.py— converts legacy.inrformat images to
NIfTI, preserving physical spacing metadata.
ML Utilities
utilities/metrics.py— Dice coefficient, SSIM, and related volume comparison
metrics. All functions expect input normalized to [0, 1] in (Z, Y, X) order.utilities/augmentation.py— spatial and intensity augmentation (flips, rotations,
noise, contrast perturbation). Validates [0, 1] normalization at entry.utilities/artifact_simulation.py—downsample_volumesimulates
lower-resolution acquisitions;preserve_extentflag controls whether physical
extent is held fixed (needed for ML coordinate normalization pipelines).utilities/sampling.py—extract_center_patchwith automatic padding for
patch-based training pipelines.
Infrastructure
- PyPI-ready packaging via
pyproject.toml+ setuptools. Package name:
pycemrg-image-analysis, requires Python >= 3.10. - GitHub Actions workflow for automated PyPI publishing on tag push.
- MkDocs-based API documentation with per-module reference pages and guides.
- Unit test suite covering components, metrics, augmentation, artifact simulation,
sampling, spatial coordinates, and scaffolding — no test data required. - Integration test suite covering myocardium, valve, and ring creation — requires
PYCEMRG_TEST_DATA_ROOTto be set; skipped automatically when absent.
Dependencies
Requires pycemrg>=0.1.0 (separate repository) for LabelManager and
ConfigScaffolder. Key third-party dependencies: SimpleITK, NumPy, SciPy,
scikit-image, trimesh, meshio, nibabel, pydicom.