DICOM Segmentation Writer 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 writes segmentation results into DICOM Segmentation objects for medical imaging workflows.
Overview#
The DICOMSegmentationWriterOperator takes segmentation data and encodes it into DICOM-compliant segmentation objects, enabling interoperability and storage in clinical systems.
Requirements#
- Holoscan SDK Python package
- pydicom
- highdicom
- SimpleITK (for image I/O, if using NIfTI or MHD files)
- numpy
Example Usage#
from pathlib import Path
from holoscan.core import Fragment
from operators.medical_imaging.dicom_seg_writer_operator import DICOMSegmentationWriterOperator, SegmentDescription
from highdicom import codes
fragment = Fragment()
seg_writer_op = DICOMSegmentationWriterOperator(
fragment,
name="seg_writer", # Optional operator name
segment_descriptions=[
SegmentDescription(
segment_label="Liver",
segmented_property_category=codes.DCM.Organ,
segmented_property_type=codes.DCM.Liver,
algorithm_name="ExampleAlgorithm",
algorithm_version="1.0.0"
)
],
output_folder=Path("output"), # Path to save the generated DICOM file(s)
custom_tags={"PatientName": "DOE^JOHN"}, # Optional: custom DICOM tags as a dict
omit_empty_frames=True # Whether to omit frames with no segmentation
)
API Reference#
Python#
DICOMSegmentationWriterOperator#
Inherits from: Operator
This operator writes out a DICOM Segmentation Part 10 file to disk
Methods#
| Method | Description |
|---|---|
__init__(fragment) |
Instantiates the DICOM Seg Writer instance with optional list of segment label strings. |
setup(spec) |
Set up the named input(s), and output(s) if applicable, aka ports. |
compute(op_input, op_output, context) |
Performs computation for this operator and handles I/O. |
process_images(image, study_selected_series_list, output_dir) |
|
create_dicom_seg(image, dicom_series, output_dir) |
|
select_input_file(input_folder, extensions) |
Select the input files based on supported extensions. |