Migration Guide - 2026.12.0
Breaking changes in this release, and how to update code that depends on them.
MONAI Physio prefers compatibility: public APIs are broken only when the change is generally beneficial to future users. When a break is unavoidable, the project does not ship deprecation shims or removed-symbol stubs. Instead, substantial changes ship with code that automates the conversion, and every break is recorded here in the commit that introduces it.
At release time this file is renamed migration_<version>.md and a fresh
migration_next.md is started for the next cycle.
Entry template
Append one section per breaking change, newest last, using this shape:
## <symbol, module, or CLI flag> - <one-line summary>
**Change:** what moved, was renamed, or changed signature.
**Why:** the benefit to future users that justified the break.
**Before**
```python
old_call(argument)
```
**After**
```python
new_call(argument, required_option="value")
```
**Automated conversion:** `<path to script or CLI>`, or `None needed`.
WorkflowReconstructHighres4DCT - renamed to WorkflowReconstruct4D
Change: The workflow, its module, its CLI and its tutorials were renamed:
Old |
New |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
The tutorial output directories and test baselines carry the new tutorial
names. Re-run pip install -e . (or reinstall the package) so the renamed
console script is registered. Behavior and arguments are unchanged.
Why: the workflow is a general 4D reconstruction, not specific to a
high-resolution reference, and the new names are shorter and follow the other
workflow_* and CLI names.
Before
from monai_physio import WorkflowReconstructHighres4DCT
workflow = WorkflowReconstructHighres4DCT(images, reference)
monai-physio-reconstruct-highres-4d-ct ...
After
from monai_physio import WorkflowReconstruct4D
workflow = WorkflowReconstruct4D(images, reference)
monai-physio-reconstruct-4d ...
Automated conversion: run both commands from the root of the code to
convert (GNU sed, for example from Git Bash on Windows). The first rewrites
references in tracked and untracked text files; git grep -I skips binary
files, and --untracked includes files not yet committed. It needs a Git
checkout; outside one, replace --untracked with --no-index. sed -b keeps
Windows (CRLF) line endings, and xargs -r skips sed when nothing matches.
git grep -lzI --untracked -E 'WorkflowReconstructHighres4DCT|reconstruct[-_]highres[-_]4d[-_]ct|tutorial_03_reconstruct_highres_' | xargs -0 -r sed -b -i -E 's/WorkflowReconstructHighres4DCT/WorkflowReconstruct4D/g; s/monai-physio-reconstruct-highres-4d-ct/monai-physio-reconstruct-4d/g; s/workflow_reconstruct_highres_4d_ct/workflow_reconstruct_4d/g; s/reconstruct_highres_4d_ct/reconstruct_4d/g; s/tutorial_03_reconstruct_highres_/tutorial_03_reconstruct_/g'
The second renames copied tutorial files and their output directories, so
references rewritten above still resolve (use git mv instead of mv to keep
history for tracked files):
find . -depth -name 'tutorial_03_reconstruct_highres_*' -not -path './.git/*' |
while IFS= read -r f; do
mv "$f" "$(dirname "$f")/$(basename "$f" | sed 's/^tutorial_03_reconstruct_highres_/tutorial_03_reconstruct_/')"
done
restrict_deformation_field_to_normal_falloff_outside_mask - sliding stops in a slip layer
Change: ProcessTransforms.restrict_deformation_field_to_normal_falloff_outside_mask
no longer takes normal_image, the second positional argument: the normal
that splits the motion into its normal and tangential parts is now the mask’s
own (the gradient of its smoothed signed distance map) rather than a surface
normal spread from the fitted mesh. It also takes two keyword-only fade
parameters instead of three:
Old |
New |
|---|---|
|
|
|
|
WorkflowInferMovement follows with the same two names as setters:
exterior_direction_offset_mm and exterior_direction_transition_mm are
replaced by set_slip_layer_mm, and exterior_falloff_length_per_displacement
by set_normal_fade_ratio (see the WorkflowInferMovement entry below). Its
process_time_series arguments after fitted_reference_mesh are now
keyword-only. Exterior warps change accordingly; the
movement_time_series_exterior test baselines were regenerated.
Also new, with no old counterpart: set_shared_fade_boundary(True) makes
process_time_series fade every stage to one boundary shared by all stages, built by the new
WorkflowInferMovement.create_zero_displacement_distance_map from
ProcessTransforms.displaced_voxel_mask and
ProcessTransforms.interior_distance_map; WorkflowInferMovement.stage_transform
builds one stage’s restricted transform.
Why: the old band carried an organ’s tangential sliding many millimeters
into the surrounding tissue (at least 8 mm in Tutorial 13). A slip interface
such as the pericardium transmits only the motion along the surface normal, so
tissue outside the organ is dragged along only within the slip layer. The
normal fade is now measured from the normal motion, past the slip layer. Its
smoothstep is steepest at 1.5 times its mean slope, so a flat push keeps a
Jacobian determinant of about 1 - 1.5 / normal_fade_ratio; the default 2
keeps at least a quarter of every tissue layer while keeping the push local. A
large slip across the layer can still fold the warp near the boundary; the
fold warning reports how many voxels fold. The motion is split where the
restriction applies, at the mask’s surface, so the mask’s own normal is used
there; a normal spread from a separately fitted mesh need not match it.
Before
transform = transform_tools.restrict_deformation_field_to_normal_falloff_outside_mask(
field, normals, mask, 3.0, 5.0, 3.0
)
workflow.process_time_series(
...,
exterior_mask=mask,
exterior_direction_offset_mm=3.0,
exterior_direction_transition_mm=5.0,
exterior_falloff_length_per_displacement=3.0,
)
After
transform = transform_tools.restrict_deformation_field_to_normal_falloff_outside_mask(
field, mask, slip_layer_mm=2.0, normal_fade_ratio=2.0
)
workflow.set_slip_layer_mm(2.0)
workflow.set_normal_fade_ratio(2.0)
workflow.process_time_series(..., exterior_mask=mask)
Automated conversion: None needed. Drop the normal_image argument (and
any code that only built it for this call), replace the offset and transition
arguments (by keyword, or the fourth and fifth positional arguments) with one
slip_layer_mm keyword, and rename falloff_length_per_displacement (and
exterior_falloff_length_per_displacement) to normal_fade_ratio, passed by
keyword. The old and new fades are measured differently (from the mask, by the
whole displacement; past the slip layer, by its normal part), so no value
reproduces the old reach exactly.
output_dir and out_dir - renamed to output_directory
Change: every public method that takes an output folder now names it
output_directory, as most of the library already did:
Class or function |
Old keyword |
New keyword |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The CLI flag --output-dir is unchanged.
Why: the same concept had three names (output_directory, output_dir,
out_dir), so a caller had to look up which one each class used.
Before
workflow = WorkflowFinetuneICONRegistration(
subject_image_files=images, output_dir=weights_dir, finetune_name="icon"
)
print(workflow.output_dir)
After
workflow = WorkflowFinetuneICONRegistration(
subject_image_files=images, output_directory=weights_dir, finetune_name="icon"
)
print(workflow.output_directory)
Automated conversion: None needed. Rename the keyword in calls to the
methods above, and the attribute on WorkflowFinetuneICONRegistration;
git grep -nE "\b(output_dir|out_dir|output_dirname)=|\.output_dir\b" lists
the candidates. Calls that pass the folder positionally need no change. A
blind rewrite of output_dir= would also rename that keyword in calls to
unrelated functions, so the list is reviewed by hand.
Mask dilation - one name, always in millimeters
Change:
Old |
New |
|---|---|
|
|
|
|
|
|
WorkflowConvertImageToUSD now dilates its registration masks with
ProcessLabelmaps.convert_labelmap_to_mask, so the radius is physical. The new
default, 6 mm, matches the old 10 voxels on the tutorial’s 0.6 mm
Slicer-Heart-CT grid.
Why: the same setting had three names and two units. Every other class
already took mask_dilation_mm and set_mask_dilation_mm, and a radius in
voxels dilates by different physical amounts on different scans.
Before
workflow = WorkflowConvertImageToUSD(..., mask_dilation_radius=10)
mask = ProcessLabelmaps().convert_labelmap_to_mask(labelmap, dilation_in_mm=5.0)
registrar.set_mask_dilation(5.0)
After
workflow = WorkflowConvertImageToUSD(..., mask_dilation_mm=6.0)
mask = ProcessLabelmaps().convert_labelmap_to_mask(labelmap, mask_dilation_mm=5.0)
registrar.set_mask_dilation_mm(5.0)
Automated conversion: run from the root of the code to convert (GNU sed,
as for the entries above). It renames the keyword and the setter;
mask_dilation_radius is then converted by hand, multiplying the old voxel
count by the image spacing.
git grep -lzI --untracked -E 'dilation_in_mm=|\.set_mask_dilation\(' | xargs -0 -r sed -b -i -E 's/\bdilation_in_mm=/mask_dilation_mm=/g; s/\.set_mask_dilation\(/.set_mask_dilation_mm(/g'
git grep -n --untracked 'mask_dilation_radius'
Name casing - ProcessPhysicsNeMo, lowercase ICON and Greedy names and flags
Change:
Old |
New |
|---|---|
|
|
|
|
|
|
|
|
|
|
CLI |
|
CLI |
|
The --method values Greedy, ICON and Greedy_ICON are unchanged.
Why: every other PhysicsNeMo class is spelled ...PhysicsNeMo..., and
Python names and CLI flags are otherwise lowercase; the exceptions had to be
remembered one by one.
Before
from monai_physio import ProcessPhysicsNemo
workflow.registrar_ICON.set_number_of_iterations(50)
result = workflow.process(use_ICON_registration_refinement=True)
monai-physio-reconstruct-4d ... --Greedy-iterations 30 15 7 3 --ICON-iterations 20
After
from monai_physio import ProcessPhysicsNeMo
workflow.registrar_icon.set_number_of_iterations(50)
result = workflow.process(use_icon_registration_refinement=True)
monai-physio-reconstruct-4d ... --greedy-iterations 30 15 7 3 --icon-iterations 20
Automated conversion: run from the root of the code to convert (GNU sed, as for the entries above):
git grep -lzI --untracked -E 'ProcessPhysicsNemo|use_ICON_|registrar_ICON|registrar_Greedy|use-ICON-refinement|Greedy[-_]iterations|ICON[-_]iterations|imreadVD3|imwriteVD3' | xargs -0 -r sed -b -i -E 's/\bProcessPhysicsNemo\b/ProcessPhysicsNeMo/g; s/\buse_ICON_registration_refinement\b/use_icon_registration_refinement/g; s/\buse_ICON_refinement\b/use_icon_refinement/g; s/\bregistrar_ICON\b/registrar_icon/g; s/\bregistrar_Greedy\b/registrar_greedy/g; s/--use-ICON-refinement/--use-icon-refinement/g; s/--Greedy-iterations/--greedy-iterations/g; s/--ICON-iterations/--icon-iterations/g; s/\bargs\.Greedy_iterations\b/args.greedy_iterations/g; s/\bargs\.ICON_iterations\b/args.icon_iterations/g; s/\bimreadVD3\b/imread_vd3/g; s/\bimwriteVD3\b/imwrite_vd3/g'
DownloadData - method names in snake_case
Change: the 22 public DownloadData methods are renamed from PascalCase
to snake_case, for example:
Old |
New |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The rest follow the same pattern (Download...Data becomes
download_..._data, Verify...Data becomes verify_..._data); the
conversion command below lists every one. The dataset names the
monai-physio-download-data CLI takes, and the DownloadData class name and
constants, are unchanged.
Why: they were the only PascalCase methods in the library; every other method follows PEP 8.
Before
from monai_physio import DownloadData
image_file = DownloadData.DownloadChestCTData("data/Chest-CT")
assert DownloadData.VerifyChestCTData("data/Chest-CT")
After
from monai_physio import DownloadData
image_file = DownloadData.download_chest_ct_data("data/Chest-CT")
assert DownloadData.verify_chest_ct_data("data/Chest-CT")
Automated conversion: run from the root of the code to convert (GNU sed, as for the entries above):
git grep -lzI --untracked -E '(Download|Verify|Fix)(SlicerHeartCT|KCLHeartModel|CHOPValve4D|ChestCT|TCIA4DLung|DukeHeart4DLabelmaps|DirLab4DCT|PhysicsNeMo[A-Za-z]+)Data' | xargs -0 -r sed -b -i -E 's/\bDownloadPhysicsNeMoPhysicsInformedMotionDukeHeartAblationData\b/download_physicsnemo_physics_informed_motion_duke_heart_ablation_data/g; s/\bVerifyPhysicsNeMoPhysicsInformedMotionDukeHeartAblationData\b/verify_physicsnemo_physics_informed_motion_duke_heart_ablation_data/g; s/\bDownloadPhysicsNeMoPhysicsInformedMotionDukeHeartData\b/download_physicsnemo_physics_informed_motion_duke_heart_data/g; s/\bVerifyPhysicsNeMoPhysicsInformedMotionDukeHeartData\b/verify_physicsnemo_physics_informed_motion_duke_heart_data/g; s/\bDownloadPhysicsNeMoMGNDukeHeartMotionData\b/download_physicsnemo_mgn_duke_heart_motion_data/g; s/\bVerifyPhysicsNeMoMGNDukeHeartMotionData\b/verify_physicsnemo_mgn_duke_heart_motion_data/g; s/\bDownloadPhysicsNeMoMGNLungMotionData\b/download_physicsnemo_mgn_lung_motion_data/g; s/\bVerifyPhysicsNeMoMGNLungMotionData\b/verify_physicsnemo_mgn_lung_motion_data/g; s/\bDownloadDukeHeart4DLabelmapsData\b/download_duke_heart_4d_labelmaps_data/g; s/\bVerifyDukeHeart4DLabelmapsData\b/verify_duke_heart_4d_labelmaps_data/g; s/\bDownloadSlicerHeartCTData\b/download_slicer_heart_ct_data/g; s/\bDownloadKCLHeartModelData\b/download_kcl_heart_model_data/g; s/\bVerifySlicerHeartCTData\b/verify_slicer_heart_ct_data/g; s/\bVerifyKCLHeartModelData\b/verify_kcl_heart_model_data/g; s/\bDownloadCHOPValve4DData\b/download_chop_valve_4d_data/g; s/\bDownloadTCIA4DLungData\b/download_tcia_4d_lung_data/g; s/\bVerifyCHOPValve4DData\b/verify_chop_valve_4d_data/g; s/\bVerifyTCIA4DLungData\b/verify_tcia_4d_lung_data/g; s/\bVerifyDirLab4DCTData\b/verify_dirlab_4dct_data/g; s/\bDownloadChestCTData\b/download_chest_ct_data/g; s/\bVerifyChestCTData\b/verify_chest_ct_data/g; s/\bFixDirLab4DCTData\b/fix_dirlab_4dct_data/g'
WorkflowInferMovement.create_deformation_field - no normal image, no files
Change: WorkflowInferMovement.create_deformation_field no longer takes
output_directory and no longer computes a surface-normal image. It returns
only deformation_field, weight_image and deformed_surface; the
normal_image key and the *_file keys are gone, and it writes nothing.
monai-physio-infer-physicsnemo --reference-image now requires --output and
writes deformation_field.mha, deformation_weight.mha and the stage surface
there itself; it no longer writes surface_normal_field.mha.
Why: the normal image existed only for the exterior restriction, which now uses the mask’s own normal, and the files were intermediate results. A workflow returns its results; the caller decides what to keep on disk.
Before
result = movement.create_deformation_field(
parameters, stage, reference_image, fitted_mesh, output_directory=out_dir
)
normals = result["normal_image"]
field_file = result["deformation_field_file"]
After
result = movement.create_deformation_field(
parameters, stage, reference_image, fitted_mesh
)
itk.imwrite(result["deformation_field"], str(out_dir / "deformation_field.mha"))
Automated conversion: None needed. Drop output_directory and write the
returned images where they are wanted; drop any use of normal_image.
WorkflowInferMovement.process and predict_single - meshes returned, no files
Change: WorkflowInferMovement.process and
WorkflowInferMovement.predict_single no longer take output_directory and no
longer write meshes (they defaulted into the model directory). process
returns subject_id, stages and stage_meshes (one pv.DataSet per stage)
instead of predicted_surfaces paths; predict_single returns stage_mesh
(a pv.DataSet) and predicted_points instead of a predicted_surface path.
monai-physio-infer-physicsnemo writes the same files as before itself.
process_time_series is unchanged: it streams each stage’s warped image to
disk so a long series does not have to fit in memory.
Why: a workflow returns its results and the caller decides what to keep on disk; writing into the model directory by default mixed predictions with trained weights.
Before
result = movement.process(manifest, output_directory=out_dir)
surfaces = result["predicted_surfaces"]
single = movement.predict_single(parameters, 0.5, fitted_mesh, output_dir)
path = single["predicted_surface"]
After
result = movement.process(manifest)
for stage, mesh in zip(result["stages"], result["stage_meshes"]):
mesh.save(str(out_dir / f"{result['subject_id']}_s{int(stage * 100):03d}_pred.vtp"))
single = movement.predict_single(parameters, 0.5, fitted_mesh)
single["stage_mesh"].save(str(out_dir / "prediction.vtp"))
Automated conversion: None needed. Drop output_directory, then save the
returned meshes where they are wanted.
Model registration - one base, settings by setter, moving model per call
Change: RegisterModelsICP, RegisterModelsICPITK,
RegisterModelsDistanceMaps and RegisterModelsPCA now derive from the new
RegisterModelsBase. The fixed model (and, for distance maps, the reference
image) is given to the constructor, options are set with set_* methods, and
register(moving_model) takes only the model to align:
Class |
Before |
After |
|---|---|---|
|
|
|
|
|
|
|
|
|
Defaults are unchanged. Invalid settings now raise ValueError from the
setter. RegisterModelsPCA keeps a register() without a moving model: the
model it deforms is its template, tied to its eigenvectors. Its
set_fixed_model(fixed_model, reference_image) and the new base’s
set_fixed_model(fixed_model) forget the previous results.
Why: the four classes shared state, results and transform conventions but
took their inputs in different places (the moving model in register() for
ICP, in the constructor for distance maps), so a caller could not swap one for
another. Options that rarely change between calls now live on the instance,
and a registrar built for one target can register many moving models.
Before
icp = RegisterModelsICP(fixed_model=patient)
icp_result = icp.register(moving_model=template, transform_type="Rigid")
registrar = RegisterModelsDistanceMaps(
moving_model=template,
fixed_model=patient,
reference_image=image,
mask_dilation_mm=10.0,
)
result = registrar.register(transform_type="Deformable", deformable_engine="greedy")
pca_result = pca.register(pca_number_of_modes=10, max_iterations=60)
After
icp = RegisterModelsICP(fixed_model=patient)
icp.set_transform_type("Rigid")
icp_result = icp.register(template)
registrar = RegisterModelsDistanceMaps(fixed_model=patient, reference_image=image)
registrar.set_mask_dilation_mm(10.0)
registrar.set_transform_type("Deformable")
registrar.set_deformable_engine("greedy")
result = registrar.register(template)
pca.set_pca_number_of_modes(10)
pca.set_max_iterations(60)
pca_result = pca.register()
Automated conversion: None needed; each call site changes in the few lines shown above.
WorkflowInferMovement and WorkflowEvaluateMovement - options by setter
Change: options that stay the same across runs moved from method
arguments to set_* methods; the methods keep only per-run inputs. Defaults
are unchanged, and invalid values raise ValueError from the setter.
Class |
Argument (method) |
Setter |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
the matching |
process_time_series keeps shape_parameters, stages, output_directory,
fitted_reference_mesh, reference_image, usd_project_name,
exterior_mask and zero_displacement_distance_map; stage_transform and
create_zero_displacement_distance_map keep their inputs and direction.
WorkflowEvaluateMovement sets its movement workflow to nearest-neighbour,
zero-background warps when it is constructed, and passes its smoothing sigma
on at each process call.
Why: the smoothing, slip layer and fade ratio had to be repeated, with the same values, on every call that builds part of one time series; as instance settings they cannot diverge between the shared-boundary pass and the warp pass. Settings now persist across calls, so a workflow configured once can process many cases.
Before
infer_result = WorkflowInferMovement(infer_workflow).process_time_series(
shape_parameters=pca_file,
stages=stages,
output_directory=out_dir,
fitted_reference_mesh=mesh_file,
reference_image=ct,
warp_background_value=-1000.0,
smoothing_sigma_mm=10.0,
anatomy_type="lung",
usd_project_name="lung",
)
result = evaluate.process(
case_id,
pca_file,
mesh_file,
truth,
out_dir,
evaluation_spacing_mm=2.0,
report_dice=False,
)
After
movement = WorkflowInferMovement(infer_workflow)
movement.set_warp_background_value(-1000.0)
movement.set_smoothing_sigma_mm(10.0)
movement.set_anatomy_type("lung")
infer_result = movement.process_time_series(
shape_parameters=pca_file,
stages=stages,
output_directory=out_dir,
fitted_reference_mesh=mesh_file,
reference_image=ct,
usd_project_name="lung",
)
evaluate.set_evaluation_spacing_mm(2.0)
evaluate.set_report_dice(False)
result = evaluate.process(case_id, pca_file, mesh_file, truth, out_dir)
Automated conversion: None needed; move each keyword to the setter of the same name before the call.
WorkflowConvertVTKToUSD - meshes to process(), options by setter
Change: WorkflowConvertVTKToUSD(...) takes only segmenter and
log_level. The meshes and where to write them go to
process(input_meshes, usd_project_name, output_directory, *, time_codes=None, object_names=None); every other option has a setter of the same name:
set_separate_by_connectivity, set_separate_by_cell_type,
set_frames_per_second, set_extract_surface, set_static_merge,
set_appearance, set_solid_color, set_anatomy_type, set_label_names,
set_colormap_primvar, set_colormap_name, set_colormap_intensity_range.
Defaults are unchanged; an invalid appearance or frame rate raises from its
setter, and the connectivity/cell-type conflict raises from process().
Why: the constructor mixed what the workflow converts with how it converts it, so converting a second set of meshes meant rebuilding the workflow and repeating every option. One configured workflow now converts many inputs.
Before
result = WorkflowConvertVTKToUSD(
input_meshes=meshes,
usd_project_name="heart",
output_directory=out_dir,
appearance="anatomy",
anatomy_type="heart",
).process()
After
workflow = WorkflowConvertVTKToUSD()
workflow.set_appearance("anatomy")
workflow.set_anatomy_type("heart")
result = workflow.process(
input_meshes=meshes, usd_project_name="heart", output_directory=out_dir
)
Automated conversion: None needed; move each constructor keyword to
process() or to the setter of the same name.
WorkflowFitStatisticalModelToPatient - patient to process(), options by setter
Change: the constructor keeps what defines the fit - template_model,
template_labelmap, labelmap_interior_object_ids, segmentation_method,
log_level. The patient moves to process(patient_models=None, patient_image=None, patient_labelmap=None); running the stages one by one
instead starts with prepare_patient(...) (same arguments), which process
calls itself. Segmenting a patient image now happens there, not in the
constructor. Options moved to setters: fitting_crop_margin_mm and
fitting_spacing_mm to set_fitting_crop_margin_mm / set_fitting_spacing_mm
(call them before process), and process(use_icon_registration_refinement=)
to set_use_icon_registration_refinement. set_distancemap_squared_max is
renamed set_distance_squared_max, the name the other workflows use.
Why: one template and its settings now fit many patients, and the constructor no longer runs a segmentation.
Before
fit = WorkflowFitStatisticalModelToPatient(
template_model=template,
patient_models=[surface],
patient_image=image,
patient_labelmap=labels,
fitting_spacing_mm=1.5,
)
fit.set_distancemap_squared_max(100.0)
result = fit.process(use_icon_registration_refinement=True)
After
fit = WorkflowFitStatisticalModelToPatient(template_model=template)
fit.set_fitting_spacing_mm(1.5)
fit.set_distance_squared_max(100.0)
fit.set_use_icon_registration_refinement(True)
result = fit.process(
patient_models=[surface], patient_image=image, patient_labelmap=labels
)
Automated conversion: rename the distance setter with
git grep -lz set_distancemap_squared_max | xargs -0 sed -i 's/set_distancemap_squared_max/set_distance_squared_max/g';
move the patient and fitting keywords by hand as shown.
WorkflowConvertImageToVTK - surface options by setter
Change: process() keeps the per-run inputs (input_image,
anatomy_groups, labelmap_image, groups). Its surface options moved to
setters of the same name: set_surface_reduction_rate,
set_extract_label_surfaces, set_extract_group_surfaces,
set_isotropic_spacing_mm, set_smoothing_iterations,
set_tetrahedra_element_size_mm. Defaults are unchanged; out-of-range values
now raise from the setter.
Why: these options describe how a project wants its surfaces, not which image is processed, so they are set once and kept across images.
Before
result = workflow.process(
input_image=image, surface_reduction_rate=0.5, extract_label_surfaces=True
)
After
workflow.set_surface_reduction_rate(0.5)
workflow.set_extract_label_surfaces(True)
result = workflow.process(input_image=image)
Automated conversion: None needed; move each keyword to the setter of the same name.
WorkflowConvertImageToUSD - images to process(), options by setter
Change: WorkflowConvertImageToUSD(segmentation_method=None, registration_method=None, log_level=...). The images and where to write go to
process(time_series_images, reference_image, usd_project_name, output_directory), which also creates the directory (the constructor no
longer touches the disk). Options moved to setters of the same name:
set_dynamic_labelmap_ids, set_mask_dilation_mm, set_frames_per_second,
set_surface_reduction_rate, set_isotropic_spacing_mm,
set_distance_sigma_mm, set_save_assets, set_save_transforms. Defaults
are unchanged.
Why: a workflow configured with a segmenter, a registrar and output options now converts any number of series.
Before
workflow = WorkflowConvertImageToUSD(
time_series_images=frames,
reference_image=frames[0],
usd_project_name="heart",
output_directory=out_dir,
frames_per_second=30.0,
)
result = workflow.process()
After
workflow = WorkflowConvertImageToUSD()
workflow.set_frames_per_second(30.0)
result = workflow.process(
time_series_images=frames,
reference_image=frames[0],
usd_project_name="heart",
output_directory=out_dir,
)
Automated conversion: None needed; move each constructor keyword to
process() or to the setter of the same name.
WorkflowCreateMeanSurface and WorkflowCreateStatisticalModel - options by setter
Change: the constructors keep only what defines the model:
WorkflowCreateMeanSurface(surfaces, log_level) and
WorkflowCreateStatisticalModel(sample_meshes, reference_mesh, log_level).
Their optional keywords moved to setters of the same name:
WorkflowCreateMeanSurface:set_template_surface,set_spatial_resolution,set_buffer_factor. Itsset_icp_transform_typenow storesicp_transform_type(wasalignment_transform_type) and also accepts"Similarity", like the other workflows.WorkflowCreateStatisticalModel:set_number_of_pca_components(already existed),set_reference_spatial_resolution,set_reference_buffer_factor,set_solve_for_surface_pca,set_icp_transform_type(already existed),set_mask_dilation_mm,set_distance_squared_max,set_project_to_measured_surfaces,set_projection_max_distance_mm. An unsetdistance_squared_maxis now derived from the mask dilation when used, so setting the dilation later still sizes it.
Defaults are unchanged.
Why: options were accepted in two places (constructor and setter) for some names and only one for others; every option now has exactly one setter.
Before
workflow = WorkflowCreateStatisticalModel(
sample_meshes=meshes,
reference_mesh=mean_mesh,
number_of_pca_components=6,
mask_dilation_mm=15.0,
)
After
workflow = WorkflowCreateStatisticalModel(
sample_meshes=meshes, reference_mesh=mean_mesh
)
workflow.set_number_of_pca_components(6)
workflow.set_mask_dilation_mm(15.0)
Automated conversion: None needed; move each keyword to the setter of the same name.
WorkflowReconstruct4D - series to process()
Change: WorkflowReconstruct4D(registration_method=None, log_level=...).
The series moves to process(time_series_images, reference_image, reference_time_frame=0, fixed_mask=None, moving_masks=None), replacing the
constructor arguments and set_fixed_mask / set_moving_masks. To run the
stages one by one (register_time_series, reconstruct_time_series), call
prepare_series(...) with the same arguments first; process calls it
itself. register_reference_time_frame_to_reference_image moved to
set_register_reference_time_frame_to_reference_image. The other setters
(set_modality, set_mask_dilation_mm, set_composite_mode,
set_upsample_to_fixed_resolution) are unchanged.
Why: a workflow configured with a registrar and options now reconstructs any number of series, and the masks travel with the series they belong to.
Before
workflow = WorkflowReconstruct4D(
time_series_images=frames,
reference_image=reference,
reference_time_frame=7,
register_reference_time_frame_to_reference_image=False,
)
workflow.set_fixed_mask(mask)
result = workflow.process()
After
workflow = WorkflowReconstruct4D()
workflow.set_register_reference_time_frame_to_reference_image(False)
result = workflow.process(
time_series_images=frames,
reference_image=reference,
reference_time_frame=7,
fixed_mask=mask,
)
Automated conversion: None needed; move the series and masks to
process() (or prepare_series()).
WorkflowFinetuneICONRegistration - training options by setter
Change: the constructor keeps the dataset and where to write
(subject_image_files, output_directory, finetune_name, subject_ids,
subject_labelmap_files, subject_mask_files, subject_landmark_files,
log_level). The training options moved to setters of the same name:
set_epochs, set_batch_size, set_learning_rate, set_input_shape,
set_similarity, set_lambda_value, set_dice_loss_weight,
set_lncc_sigma, set_ct_window, set_is_ct, set_gpus,
set_eval_period, set_save_period, set_unigradicon_src_path, set_seed.
Defaults are unchanged; counts, rates and weights are validated by their
setters.
Why: fifteen optional keywords made the constructor hard to read and to override selectively; each option is now set where it is changed.
Before
workflow = WorkflowFinetuneICONRegistration(
subject_image_files=files,
output_directory=out_dir,
finetune_name="lung",
epochs=100,
batch_size=2,
)
After
workflow = WorkflowFinetuneICONRegistration(
subject_image_files=files, output_directory=out_dir, finetune_name="lung"
)
workflow.set_epochs(100)
workflow.set_batch_size(2)
Automated conversion: None needed; move each keyword to the setter of the same name.
WorkflowTrainPhysicsNeMo - options by setter
Change: use_template_surface and resume_from moved from the
constructor to set_use_template_surface and set_resume_from (which now
checks that the checkpoint exists). The constructor keeps the manifests, the
template mesh, the output directory and the training method.
Why: both are optional choices about one training run’s setup, not what defines it; they follow the library’s setter convention.
Before
workflow = WorkflowTrainPhysicsNeMo(
train_manifests, val_manifests, mean_mesh, out_dir, resume_from=checkpoint
)
After
workflow = WorkflowTrainPhysicsNeMo(train_manifests, val_manifests, mean_mesh, out_dir)
workflow.set_resume_from(checkpoint)
Automated conversion: None needed; move each keyword to the setter of the same name.
Aorta flow workflows - solver options by setter
Change: AortaWorkflowSimulateFlow1DNS, AortaWorkflowSimulateFlow3DNS
and AortaWorkflowSimulateFlowFSINS keep their per-run inputs in process()
(labelmap_image, inflow_m3_s, inflow_interval_s, geometry and, for 3D
and FSI, mesh). The labels and solver options moved to setters of the same
name: set_aorta_label_ids, set_branch_label_ids, set_beats, set_dt_s,
set_calibrate_outlets (all three); set_element_size_mm, set_precision,
set_frame_interval_s (3D and FSI); set_spacing_mm, set_collar_mm (FSI).
aorta_label_ids and branch_label_ids were process()’s second and third
positional arguments. Defaults are unchanged, including each workflow’s own
time step; values that are invalid on their own (fewer than two beats, a
non-positive step) now raise from the setter, and those that depend on the
inflow still raise from process().
Why: the labels follow the segmenter and the solver options the study, not the case, so a workflow configured once simulates many inflows and patients.
Before
result = workflow.process(
labelmap,
(1,),
{"BCT": 2},
inflow_m3_s=inflow,
inflow_interval_s=dt,
beats=4,
dt_s=0.002,
)
After
workflow.set_aorta_label_ids((1,))
workflow.set_branch_label_ids({"BCT": 2})
workflow.set_beats(4)
workflow.set_dt_s(0.002)
result = workflow.process(labelmap, inflow_m3_s=inflow, inflow_interval_s=dt)
Automated conversion: None needed; move each keyword (and the two positional label arguments) to the setter of the same name.
MONAIPhysioBase logging - each object’s log_level is honored
Change: every object now logs at its own log_level. Before, the first
object constructed set the level of the shared MONAIPhysio logger and later
objects’ log_level was ignored. MONAIPhysioBase.set_log_level is now a
floor on every object: raising it still silences messages below it, but
lowering it no longer makes an object log below its own log_level.
Why: a caller can quiet one noisy object, or debug one stage, without changing every other object’s output, and the result no longer depends on which object happened to be constructed first.
Before
workflow = WorkflowInferMovement(inference_workflow)
MONAIPhysioBase.set_log_level(logging.DEBUG) # every object logged DEBUG
After
workflow = WorkflowInferMovement(inference_workflow, log_level=logging.DEBUG)
MONAIPhysioBase.set_log_level(logging.DEBUG) # only lowers the floor
Automated conversion: None needed; pass log_level to each object that
should log below INFO.