Predict With a Trained Surrogate
physiotwin4d-infer-physicsnemo loads a model directory written by
physiotwin4d-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:
physiotwin4d-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 reference + prediction meshes, a
reference surface colored by per-point RMSE, and error statistics in
millimetres, instead of the raw target arrays.
Pass --stages 0.15 0.35 to predict arbitrary stages instead of the
manifest’s phases; no ground truth exists for those, so no statistics are
written.
Single-Subject Mode
No manifest — just the subject’s PCA coefficients:
physiotwin4d-infer-physicsnemo \
--model-dir output/mgn_run \
--shape-parameters Case1Pack_ssm_pca_coefficients.json \
--stage 0.7 \
--reference-mesh Case1Pack_ssm_surface.vtp \
--output output/prediction
Omit --reference-mesh to displace the mesh reconstructed from the PCA
coefficients alone, which needs no per-subject geometry but stays in the
model’s own frame. Supply --ground-truth to score the prediction against a
known surface.
Deformation Fields
With --reference-image, the command rasterizes the predicted displacements
and the reference-surface normals onto that image’s voxel grid:
physiotwin4d-infer-physicsnemo \
--model-dir output/mgn_run \
--shape-parameters coefficients.json \
--stage 0.5 \
--reference-mesh patient_surface.vtp \
--reference-image patient_ct.mha \
--output output/fields
This writes deformation_field.mha and surface_normal_field.mha —
apply them to volumes and labelmaps with
TransformTools.
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,--reference-mesh PATH,--ground-truth PATH,--reference-image PATHSingle-subject mode, as above.
--output PATHOutput directory; defaults to a subdirectory of the model directory.