Architecture

MONAI Physio is a beta scientific Python package organized around explicit workflow classes and smaller registration, segmentation, geometry, and USD utilities that together create personalized physiological digital twins from 3D medical images. Runtime workflow classes inherit from MONAIPhysioBase for logging and common runtime configuration. The image, mesh and transform conventions every component follows are listed once, in Data Conventions.

Assembly Map

The interactive assembly map shows how the building-block classes, grouped by function, feed the workflows, which workflows call each other, and which workflows each tutorial combines. Open the interactive assembly map, then hover, tap or tab to any box to trace its connections.

MONAI Physio assembly map linking functional groups to workflows and tutorials

Static view of the assembly map. Select the image to open the interactive version.

Data Flow

4D CT / time-series CT
       |
       v
ConvertImage4DTo3D / ProcessImages
       |
       v
RegisterTimeSeriesImages
   |        |
   |        +--> RegisterImagesANTS / RegisterImagesGreedy / RegisterImagesICON
   |        +--> RegisterImagesGreedyICON / RegisterImagesChain (chained methods)
   |        +--> WorkflowFinetuneICONRegistration (finetune ICON on subject data)
   v
SegmentChestTotalSegmentator / SegmentChestTotalSegmentatorWithContrast
SegmentHeartSimpleware / SegmentHeartSimplewareTrimmedBranches
SegmentNVSegmentCTMRI (CT + MRI)
SegmentNVSegmentCT (CT only)
       |
       v
ProcessSurfaceMesh + ProcessVolumetricMesh + ProcessTransforms
       |
       v
WorkflowConvertImageToVTK / ConvertVTKToUSD / WorkflowConvertVTKToUSD
       |
       v
OpenUSD assets for NVIDIA Omniverse

Population meshes --> WorkflowCreateStatisticalModel (PCA shape model)
                           |
                           v
Patient surfaces/image --> WorkflowFitStatisticalModelToPatient
                           |
                           v
Fitted SSM propagated across gated phases (WorkflowReconstruct4D)
                           |
                           v
PhysicsNeMo AI surrogate training (MeshGraphNet / MLP) and evaluation

Primary Workflows

WorkflowConvertImageToUSD

Converts a 4D cardiac CT file or 3D CT time series into registered anatomy contours and painted animated USD files.

WorkflowConvertImageToVTK

Segments a 3D CT image and exports anatomy groups as VTK surfaces.

WorkflowCreateMeanSurface

Builds an unbiased mean surface from a population, so a shape model can be built without privileging any one subject as the template.

WorkflowCreateStatisticalModel

Aligns a population of meshes to a reference and builds a PCA statistical shape model.

WorkflowFitStatisticalModelToPatient

Fits a template/statistical model to patient-specific surfaces with ICP, optional PCA fitting, labelmap-to-labelmap registration, and optional labelmap-to-image refinement.

WorkflowReconstruct4D

Reconstructs 4D CT or MRI frames by registering a time series to a fixed reference image.

WorkflowFinetuneICONRegistration

Finetunes a uniGradICON checkpoint on subject-specific image/labelmap/ landmark data and returns the path to the resulting weights, which RegisterImagesICON can then load.

WorkflowConvertVTKToUSD

Converts in-memory PyVista/VTK meshes to static or animated USD scenes through the supported workflow wrapper. The lower-level monai_physio.vtk_to_usd package exposes advanced file conversion primitives.

WorkflowEvaluateMovement

Scores predicted motion per anatomic structure against the frames that were actually acquired, reporting volume difference, Dice and surface RMSE on a single isotropic evaluation grid. It wraps WorkflowInferMovement, so it measures whatever that produces.

WorkflowTrainPhysicsNeMo / WorkflowInferPhysicsNeMo

Train a PhysicsNeMo surrogate (MeshGraphNet or MLP) on per-point targets named by a manifest, and run it on new shape parameters and stages.

WorkflowInferMovement

Turns predicted displacements into geometry: deformed meshes, dense deformation fields, and images warped through them, optionally restricted to the motion along an organ’s surface normal outside it.

AortaWorkflowSimulateFlow1DNS / AortaWorkflowSimulateFlow3DNS / AortaWorkflowSimulateFlowFSINS

Simulate blood flow in a segmented aorta: a 1D rigid-wall model, a 3D rigid-wall Navier-Stokes solve, and a 3D solve with a moving hyperelastic wall; the 3D solves run on NVIDIA Warp.

AI Surrogate Workflows (PhysicsNeMo)

The middle tier of tutorials (tutorial_08 through tutorial_13) turns a fitted statistical shape model into a trained AI physiological surrogate, replacing the explicit per-phase registration solve with a learned model at inference time:

tutorial_08_fit_model_to_4d_patients_tcia_lung_4d_ct.py

Fits the lung PCA model to a TCIA-4DLung case (via WorkflowFitStatisticalModelToPatient) and propagates the fitted surface through every respiratory phase using ICON-based registration (WorkflowReconstruct4D), producing the per-phase surfaces used as AI surrogate training data.

tutorial_09_train_physicsnemo_mgn_tcia_lung_4d_ct.py

Trains a PhysicsNeMo surrogate with WorkflowTrainPhysicsNeMo, driving a graph-based TrainPhysicsNeMoMGN (MeshGraphNet) method on the Tutorial 8 output. The tutorial writes each phase’s training target - here the per-vertex displacement - into a mesh point-data array the manifest names, so the same stack trains on any per-point target of any width. It then evaluates the held-out cases with WorkflowInferPhysicsNeMo wrapped in WorkflowInferMovement, turning predicted displacements back into surfaces without running registration - i.e. the AI surrogate stands in for WorkflowReconstruct4D at inference time. Requires PhysicsNeMo and torch-geometric (base dependencies), torch-scatter built for your PyTorch (installed separately; see Installation) and Python >= 3.11.

tutorial_10_infer_physicsnemo_mgn_tcia_lung_4d_ct.py

Loads that checkpoint and predicts the case’s surface at a requested stage with WorkflowInferPhysicsNeMo plus WorkflowInferMovement, then exports it as USD - one forward pass in place of the registration solve that produced the training data, and able to predict stages that were never acquired.

tutorial_11_evaluate_physicsnemo_tcia_lung_4d_ct.py

Scores the same prediction with WorkflowEvaluateMovement, against the images rather than against the registration Tutorial 10 compares to. It carries the reference frame’s labelmap into each gated time point through the network’s own deformation and compares it to the labelmap of the frame that was acquired, reporting volume difference and surface RMSE per structure (plus Dice per chamber in the duke_heart variant).

tutorial_12_infer_respiratory_motion_tcia_lung_4d_ct.py

Collapses the chain into one script: segment the reference frame, fit the shape model to that patient, and infer every stage - no registration anywhere, and nothing read from Tutorial 8. This is the shape the deployed pipeline takes, and why it runs in minutes where Tutorial 8 runs in hours.

tutorial_13_combine_heart_and_lung_motion_chest_3d_ct.py

Drives two trained networks over a single static clinical CT, animating respiratory and cardiac motion together on a scan that has no 4D acquisition behind it at all.

These tutorials are thin drivers over the WorkflowTrainPhysicsNeMo / WorkflowInferPhysicsNeMo workflow classes; each workflow owns the data side (manifests, normalization, datasets, saving) and delegates the network to a method class (TrainPhysicsNeMoBase / InferPhysicsNeMoBase subclass). The manifest is the extension point: it names the point-data array holding the targets, which the stack reads verbatim, so the same code trains on displacement or on any other per-point quantity. See PhysicsNeMo AI Surrogates.

They follow the same fit -> propagate -> train -> predict pattern the rest of the workflow layer uses, and are the intended template for future cardiac, respiratory, and electrophysiology AI surrogates.

Later Tutorial Tiers

tutorial_14 and tutorial_15

Probe the trained surrogates: how much the shape parameters move the predicted motion, and a leave-one-out cross-validation of the whole fit -> train -> predict chain.

tutorial_16 through tutorial_18

Build a volumetric shape model of the myocardium, train a mechanics-aware (physics-informed) cardiac motion surrogate on it, and predict myocardial motion together with the stress it implies.

tutorial_19 through tutorial_21

Simulate blood flow in the aorta of Tutorial 13’s labelmap with the Aorta workflows: 1D and 3D rigid-wall Navier-Stokes, then a 3D solve with a moving wall.

Component Boundaries

Segmentation classes produce anatomy masks or labelmaps from ITK images. SegmentAnatomyBase subclasses (SegmentChestTotalSegmentator, SegmentChestTotalSegmentatorWithContrast, SegmentHeartSimpleware, SegmentHeartSimplewareTrimmedBranches, SegmentNVSegmentCTMRI, SegmentNVSegmentCT) share the same segment/taxonomy interface, so new segmentation methods or anatomy groups slot in without touching the workflow layer.

Deriving from a base class propagates capability, not just interface. Each SegmentAnatomyBase subclass owns an AnatomyTaxonomy instance and declares its own group→organ label map by calling self.taxonomy.add_organ(group_name, label_id, organ_name) for every label it produces - a new segmenter for a new organ or data type only has to declare that map once. Everything downstream reads it rather than special-casing the segmenter: ConvertVTKToUSD groups label-mode mesh prims under per-anatomy-group Xforms (/World/{name}/{group}/{organ}) straight from the taxonomy, and ProcessUSDAnatomy looks up DEFAULT_RENDER_PARAMS by group name to assign the matching OmniSurface material. A group without a registered look still renders (via the "other" fallback), so a new segmentation class is usable end-to-end - segmented, meshed, grouped, and materialized - before anyone writes a custom render style for it.

Registration classes produce ITK transforms or transformed meshes. RegisterImagesBase subclasses (RegisterImagesANTS, RegisterImagesGreedy, RegisterImagesICON) implement a single registration method; RegisterImagesChain and RegisterImagesGreedyICON compose two registrars into a coarse-to-fine chain. The model registrars (RegisterModelsICP, RegisterModelsICPITK, RegisterModelsPCA, RegisterModelsDistanceMaps) have no shared base class: each derives directly from MONAIPhysioBase with its own interface.

Geometry utilities bridge ITK masks and PyVista meshes. ProcessVolumetricMesh fills a mask with tetrahedra either itself (voxel-based) or through an external mesher - netgen, an optional Python extra, or Simpleware Medical, run as a subprocess through the same launcher the Simpleware segmenters use. USD tools are responsible for OpenUSD stage creation, material assignment, coordinate conversion, and time samples.

The high-risk boundary is the ITK-to-PyVista-to-USD path. Image data remains in ITK’s native LPS world space until contours are extracted. Meshes are represented as PyVista objects (still in LPS) before USD export. The VTK-to-USD layer applies the repository’s LPS-to-USD-Y-up coordinate transform during USD conversion; Data Conventions gives the axis mapping.

CLI Boundary

The installed CLI commands in pyproject.toml are thin wrappers around the workflow classes. They are the preferred examples for executable API usage:

  • monai-physio-convert-image-4d-to-3d

  • monai-physio-convert-image-to-usd

  • monai-physio-convert-image-to-vtk

  • monai-physio-convert-vtk-to-usd

  • monai-physio-create-statistical-model

  • monai-physio-download-data

  • monai-physio-fit-statistical-model-to-patient

  • monai-physio-infer-physicsnemo

  • monai-physio-reconstruct-4d

  • monai-physio-train-physicsnemo

  • monai-physio-visualize-pca-modes

monai-physio-train-physicsnemo and monai-physio-infer-physicsnemo wrap WorkflowTrainPhysicsNeMo and WorkflowInferPhysicsNeMo. There is no CLI wrapper for WorkflowFinetuneICONRegistration; it is used through the Python API and tutorial scripts.