DICOMLabelMapSegPlugin

Custom DICOM plugin for loading Label Map Segmentation Storage files.

This plugin handles DICOM SEG files with LABELMAP encoding (DICOM Supplement 243), which use SOP Class UID 1.2.840.10008.5.1.4.1.1.66.7 (Label Map Segmentation Storage).

The standard Slicer DICOMSegmentationPlugin (based on dcmqi) only supports SOP Class UID 1.2.840.10008.5.1.4.1.1.66.4 (Segmentation Storage) used for BINARY and FRACTIONAL encodings.

This plugin uses highdicom for reading LABELMAP files, which provides full support for DICOM Supplement 243.

See ADR-019 for design rationale.

References: - DICOM Supplement 243: Label Map Segmentation - dcmqi issue #518: https://github.com/QIICR/dcmqi/issues/518 - OHIF v3.11+ supports LABELMAP natively

Classes

class DICOMLabelMapSegPlugin

DICOM plugin to load Label Map Segmentation Storage files using highdicom.

This plugin enables CrossSegmentationExplorer and other Slicer DICOM workflows to work with LABELMAP-encoded DICOM SEG files created by highdicom.

Features: - Detects LABELMAP SOP Class (1.2.840.10008.5.1.4.1.1.66.7) - Uses highdicom.seg.Segmentation for parsing - Converts to vtkMRMLSegmentationNode with proper geometry - Preserves segment metadata (labels, colors, terminology)

Usage:

# Plugin is auto-registered when module loads # Then use standard DICOM import workflow: from DICOMLib import DICOMUtils DICOMUtils.loadSeriesByUID([series_uid])

Methods:

__init__()

Initialize the plugin.

examineForImport()

Examine files to determine if they can be loaded.

load()

Load the DICOM SEG file and create Slicer segmentation node.

Functions

examineForImport()

Examine files to determine if they can be loaded.

Called by the DICOM browser when examining files for import.

Args:

fileLists: List of file lists (each list is files for one series).

Returns:

List of DICOMLoadable objects for loadable files.

load()

Load the DICOM SEG file and create Slicer segmentation node.

Args:

loadable: DICOMLoadable object from examineForImport.

Returns:

True if loading succeeded, False otherwise.

f_inv()
gamma()
register_plugin()

Register the DICOM plugin with Slicer.

Call this function when the module loads to enable LABELMAP SEG loading.

is_labelmap_seg()

Check if a DICOM file is a LABELMAP SEG.

Utility function for quick SOP Class checking.

Args:

filepath: Path to DICOM file.

Returns:

True if file is a LABELMAP SEG, False otherwise.