Skip to content

Commit

Permalink
Merge pull request #401 from Project-MONAI/seg_add_empty_frames_omit
Browse files Browse the repository at this point in the history
Expose option to omit empty frames
  • Loading branch information
CPBridge authored Dec 7, 2022
2 parents 3a68559 + a8a1d8b commit 42bec18
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion monai/deploy/operators/dicom_seg_writer_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def __init__(
self,
segment_descriptions: List[SegmentDescription],
custom_tags: Optional[Dict[str, str]] = None,
omit_empty_frames: bool = True,
*args,
**kwargs,
):
Expand All @@ -192,12 +193,15 @@ def __init__(
Args:
segment_descriptions: List[SegmentDescription]
Object encapsulating the description of each segment present in the segmentation.
custom_tags: OptonalDict[str, str], optional
custom_tags: Optional[Dict[str, str]], optional
Dictionary for setting custom DICOM tags using Keywords and str values only
omit_empty_frames: bool, optional
Whether to omit frames that contain no segmented pixels from the output segmentation.
"""

self._seg_descs = [sd.to_segment_description(n) for n, sd in enumerate(segment_descriptions, 1)]
self._custom_tags = custom_tags
self._omit_empty_frames = omit_empty_frames

def compute(self, op_input: InputContext, op_output: OutputContext, context: ExecutionContext):
"""Performs computation for this operator and handles I/O.
Expand Down Expand Up @@ -290,6 +294,7 @@ def create_dicom_seg(self, image: np.ndarray, dicom_series: DICOMSeries, output_
manufacturer_model_name="MONAI Deploy App SDK",
software_versions=version_str,
device_serial_number="0000",
omit_empty_frames=self._omit_empty_frames,
)

# Adding a few tags that are not in the Dataset
Expand Down

0 comments on commit 42bec18

Please sign in to comment.