MONAI Bundle Inference Operator#
Authors: Holoscan SDK Team (NVIDIA)
Supported platforms: x86_64, aarch64
Language: Python
Last modified: August 5, 2025
Latest version: 1.1.0
Minimum Holoscan SDK version: 1.0.3
Tested Holoscan SDK versions: 2.2.0, 3.2.0
Contribution metric: Level 2 - Trusted
This operator performs inference using MONAI Bundles for medical imaging tasks.
Overview#
The MonaiBundleInferenceOperator loads a MONAI Bundle model and applies it to input medical images for inference, supporting flexible deployment in Holoscan pipelines.
Requirements#
- Holoscan SDK Python package
- MONAI
- torch
Example Usage#
from pathlib import Path
from holoscan.core import Fragment
from operators.medical_imaging.monai_bundle_inference_operator import MonaiBundleInferenceOperator
from operators.medical_imaging.core import AppContext, IOMapping, IOType, Image
fragment = Fragment()
app_context = AppContext({}) # Initialize with empty args dict
bundle_op = MonaiBundleInferenceOperator(
fragment,
name="monai_bundle", # Optional operator name
app_context=app_context,
input_mapping=[
IOMapping(
label="image",
data_type=Image,
storage_type=IOType.IN_MEMORY
)
],
output_mapping=[
IOMapping(
label="pred",
data_type=Image,
storage_type=IOType.IN_MEMORY
)
],
model_name="model", # Name of the model in the bundle
bundle_path=Path("model/model.ts") # Path to the MONAI bundle
)
API Reference#
Python#
MonaiBundleInferenceOperator#
Inherits from: InferenceOperator
This inference operator automates the inference operation for a given MONAI Bundle.
Methods#
| Method | Description |
|---|---|
__init__(fragment) |
Create an instance of this class, associated with an Application/Fragment. |
model_name() |
|
model_name(name) |
|
bundle_path() |
The path of the MONAI Bundle model. |
bundle_path(bundle_path) |
|
parser() |
The ConfigParser object. |
parser(parser) |
|
setup(spec) |
|
compute(op_input, op_output, context) |
Infers with the input(s) and saves the prediction result(s) to output |
predict(data) |
Predicts output using the inferer. |
pre_process(data) |
Processes the input dictionary with the stored transform sequence self._preproc. |
post_process(data) |
Processes the output list/dictionary with the stored transform sequence self._postproc. |