Description
Is your enhancement request related to a problem? Please describe.
I have created a MAP based on a model (in MONAI bundle format) that performs liver, spleen, and pancreas segmentation on a CT series. The resulting DICOM SEG output (after setting omit_empty_frames
to False
in the DICOMSegmentationWriterOperator) has 3*(input DICOM series #) images present. For example, testing with an input DICOM series of 204 images produces an output DICOM SEG of 612 images, which consists of the three, non-overlapping segmentations (liver, then spleen, then pancreas). The multiplier applied is obviously based on the number of items being segmented, and thus the length of the segment_descriptions
array (three in my case):
_algorithm_name = "3D Abdominal Organ Segmentation from CT Image"
_algorithm_family = codes.DCM.ArtificialIntelligence
_algorithm_version = "0.4.3"
segment_descriptions = [
SegmentDescription(
segment_label="Liver",
segmented_property_category=codes.SCT.Organ,
segmented_property_type=codes.SCT.Liver,
algorithm_name=_algorithm_name,
algorithm_family=_algorithm_family,
algorithm_version=_algorithm_version,
),
SegmentDescription(
segment_label="Spleen",
segmented_property_category=codes.SCT.Organ,
segmented_property_type=codes.SCT.Spleen,
algorithm_name=_algorithm_name,
algorithm_family=_algorithm_family,
algorithm_version=_algorithm_version,
),
SegmentDescription(
segment_label="Pancreas",
segmented_property_category=codes.SCT.Organ,
segmented_property_type=codes.SCT.Pancreas,
algorithm_name=_algorithm_name,
algorithm_family=_algorithm_family,
algorithm_version=_algorithm_version,
)
]
Similar behavior is observed with MONAI provided examples, such as the ai_pancreas_seg_app. In this case, two items are being segmented (pancreas and tumors), segment_descriptions
array length is two, and the resulting DICOM SEG output series has 2*(input DICOM series #) images present.
Describe the solution you'd like
I would like to know if it is possible to "merge" the DICOM SEGs produced for each organ segmentation into a single DICOM SEG series that matches the input DICOM series # and has "overlapping" segmentations (in the sense that multiple different organ segmentations can be present on the same DICOM SEG output image). This would likely require that the DICOM SEG be a multi-channel image that could differentiate multiple segmentations. I think ideally, this would be implemented into the DICOMSegmentationWriterOperator as an optional parameter (perhaps similarly to how omit_empty_frames
is implemented) which the user could set to True
or False
depending on if they want the DICOM SEGs merged or not.
Describe alternatives you've considered
An alternative would be to develop an additional operator, to be executed after completion of the DICOMSegmentationWriterOperator, that could execute the merging.
Additional context
This may fall somewhere in between an enhancement and a feature.
Parsing through old issues in this repository, Issue #422 seemed to propose something similar in terms of "combining segmentations in order to produce a single result". I checked out the JT/MergeVolume
branch as suggested in that thread, but couldn't find a MergeAndMask operator; MergeVolume operator is present but seems more relevant to Issue #420.