Skip to main content

Getting started with VxProstate

warning

The pipeline modules require an environment where CUDA is installed. Running the pipeline on MacOS is therefore not supported at this time.

Quickstart

  1. Install virdx_pipeline globally via pixi: pixi global install virdx_pipeline. You might need to fix the version virdx_pipeline==0.0.7.
  2. Run the newly-exposed CLI tool: vipipe --study-path ./BB_043/. You may want to copy some MRI study data to your working directory beforehand.

Alternative: the inference_api repo

You may also use the Python interface exposed by the inference_api repo. Clone the repo, navigate to its root, and run pixi run -e cuda python scripts/run_all.py.

>> cp -r /mnt/storage/data/clinical_trials/bamberg/v3/train/BB_043 .
>> pixi run -e cuda python scripts/run_all.py
2025-07-07 08:41:02 - virdx_pipeline - INFO - Using vify output name: BB_043/pipeline_outputs/vify_results.json
2025-07-07 08:41:02 - virdx_pipeline - INFO - Loading study volumes from: ./BB_043
2025-07-07 08:41:06 - virdx_pipeline - INFO - Starting Virdx Pipeline
2025-07-07 08:41:06 - virdx_pipeline - INFO - Running: viseg anat

Running viseg

Add the viseg-dependency: pixi add viseg

viseg-anatomy

In order to run inference, you need an instance of VisegInferenceModel:

viseg_anat_model = VisegInferenceModel(
model_id="07cd3faf473d4888b879cfbdaf271b87",
device="cuda:0",
)

model_id needs to be an identifier of a model available on ClearML.

With this, we can now segment a provided T2 volume:

# returns a tuple (seg_mask, class_probabilities, uncertainty_volumes)
res = viseg_anat_model.predict_sample(input_vols=[input_volume])

viseg-lesion

Lesion segmentation is performed similarly:

# multiple volumes are required for inference
input_volumes = [t2_vol, adc_vol, dwi_vol, organs_mask]
crop_mask = prostate_mask

# initialize a ClearML inference module
viseg_lesion_model = VisegInferenceModel(
model_id="6dbbdbd148f54c51a2b5acab4bedbb12",
device=config.device,
)

seg_mask, probs_volumes, _ = viseg_lesion_model.predict_sample(
input_vols=input_volumes, crop_mask=crop_mask
)

Running vireg

from vireg.inference import register_vols

moved_volume, transform = register_vols(
fixed_volume,
moving_volume,
return_transform=True,
registration_method=registration_method,
transformation_type=transform_type,
n_threads=n_threads,
mask_vol_fixed=mask_volume,
interpolation_mode=interpolation_mode,
)

Running mismo

from mismo.data import get_study_from_volumes
from mismo.fitter_training.nn_fitters import ModelFitter
from mismo.fitter_training.utils import (
find_fitter_from_local_path,
find_fitter_from_model_registry,
)
from mismo.fitting import do_nn_fitting

# setup
model_name = "OriginalVERDICT"
fitting_scheme = "scheme1",

# given DWI Volumes, we need to extract mismo-specific data structures
dwis = ...
study = get_study_from_volumes(dwis, filter=False)
study = preprocess_study(study, model_name, keep_b0_values=keep_b0_values)
protocol = study.get_dwi_acquisition_parameters()

# we obtain a neural-network fitter from ClearML
clearml_model = find_fitter_from_model_registry(
protocol,
model_type="OriginalVERDICT",
training_scheme=fitting_scheme,
snr=snr,
only_published=True,
is_trace=is_trace,
)
fitter_cls = ModelFitter.from_clearml_model(
clearml_model, device=device
)

pm_volumes = do_nn_fitting(
study,
fitter_cls,
"train",
model_name="OriginalVERDICT",
fitting_scheme="scheme1",
snr=30,
use_prostate_mask=False,
use_model_registry=True,
path_to_models=None,
device=device,
is_trace=is_trace,
)

Running vify

model = VifyInferenceModel(
softmax_cut_off=les_cutoff,
dilation_factor=dilation_factor,
min_lesion_volume=min_lesion_volume,
num_workers=num_workers,
num_predict_lesions=num_predict_lesions,
)

# inputs are obtained from previous pipeline steps + clinical data
anat_mask, prostate_mask, lesion_softmax, mismo_maps = ...
psa, age = ...

results = model.infer(
anatomy_mask=anat_mask,
prostate_mask=prostate_mask,
lesion_softmax=lesion_softmax,
data_maps=mismo_maps,
psa=psa,
age=age,
)