Workflow Development Guide
Workflow classes coordinate multiple processing steps behind a stable Python API and, where useful, an installed CLI command.
Current Workflow Mapping
CLI command |
Workflow class |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reads a |
That is all eleven installed commands. Two workflow classes have no CLI
wrapper: physiotwin4d.WorkflowFinetuneICONRegistration and
physiotwin4d.WorkflowEvaluateMovement.
Workflow Example
from pathlib import Path
import itk
from physiotwin4d import RegisterImagesICON, WorkflowConvertImageToUSD
frame_files = sorted(Path("data/Slicer-Heart-CT").glob("slice_???.mha"))
time_series_images = [itk.imread(str(path)) for path in frame_files]
workflow = WorkflowConvertImageToUSD(
time_series_images=time_series_images,
reference_image=time_series_images[0],
output_directory="./results",
usd_project_name="patient_001",
registration_method=RegisterImagesICON(),
)
results = workflow.process()
Adding a Workflow
Inherit from
physiotwin4d.PhysioTwin4DBase.Keep the constructor explicit and typed.
Use
self.log_info()andself.log_debug()for runtime status.Keep file I/O behavior predictable and documented.
Add a CLI wrapper only when the workflow is useful from the command line.
Add focused tests using synthetic data where possible.
Run
graphify update .after public API changes — methods added, modified, or removed.
Risk Areas
Changes at the ITK-to-PyVista boundary, time-series transform direction, or LPS-to-USD-Y-up coordinate conversion are high risk and should include focused tests plus visual or metadata validation.