Predict With a Trained Surrogate
monai-physio-infer-physicsnemo loads a model directory written by
monai-physio-train-physicsnemo and predicts a subject’s per-vertex targets
at any stage - including stages that were never acquired, which is the reason
to train a surrogate. It is the command-line form of
WorkflowInferPhysicsNeMo and
WorkflowInferMovement.
Requires the same optional extra as training.
Manifest Mode
Predict every phase in a manifest and score against its stored targets:
monai-physio-infer-physicsnemo \
--model-dir output/mgn_run \
--manifest manifests/Case1Pack_manifest.json \
--output output/mgn_run/eval
Add --displacement when the targets are displacements from the subject’s
reference mesh: the command then writes one reference + prediction mesh per
stage, <subject>_s<sss>_pred.vtp (.vtu for a volume mesh), instead of
the raw target arrays, to --output or, without it,
<model-dir>/<subject>.
Pass --stages 0.15 0.35 to predict arbitrary stages instead of the
manifest’s phases.
Single-Subject Mode
No manifest - just the subject’s PCA coefficients:
monai-physio-infer-physicsnemo \
--model-dir output/mgn_run \
--shape-parameters Case1Pack_ssm_pca_coefficients.json \
--stage 0.7 \
--fitted-reference-mesh Case1Pack_ssm_surface.vtp \
--output output/prediction
--fitted-reference-mesh is required in single-subject mode: it is the
patient’s fitted shape-model surface, written by
monai-physio-fit-statistical-model-to-patient. The predicted mesh is written
as <shape-parameters stem>_pred_s<sss>.vtp to --output or, without it,
<model-dir>/single_prediction.
Deformation Fields
With --reference-image, the command rasterizes the predicted displacements
onto that image’s voxel grid:
monai-physio-infer-physicsnemo \
--model-dir output/mgn_run \
--shape-parameters coefficients.json \
--stage 0.5 \
--fitted-reference-mesh patient_surface.vtp \
--reference-image patient_ct.mha \
--output output/fields
This writes deformation_field.mha, deformation_weight.mha (the vertex
count per voxel) and the stage surface deformed_surface.vtp (.vtu for a
volume mesh) to --output, which this mode requires. Spread the field with
smooth_deformation_field_transform(),
normalized by the weight image, to apply it to volumes and labelmaps.
Options
--model-dir PATHRequired. The trained model directory.
--network {mgn,mlp,auto}Auto-detected from the checkpoint present in
--model-dirby default.--epoch NLoad a periodic epoch checkpoint instead of the final weights.
--manifest JSON,--stages [FLOAT ...],--displacementManifest mode, as above.
--shape-parameters JSON,--stage FLOAT,--fitted-reference-mesh PATH,--reference-image PATHSingle-subject mode, as above.
--output PATHOutput directory; defaults to a subdirectory of the model directory.