monai.deploy.operators.DICOMSegmentationWriterOperator¶
- class monai.deploy.operators.DICOMSegmentationWriterOperator(segment_descriptions, custom_tags=None, omit_empty_frames=True, *args, **kwargs)[source]¶
Bases:
monai.deploy.core.operator.Operator
This operator writes out a DICOM Segmentation Part 10 file to disk
Constructor of the base operator.
It creates an instance of Data Store which holds on to all inputs and outputs relavant for this operator.
- Parameters
args – Arguments.
kwargs – Keyword arguments.
Methods
__init__
(segment_descriptions[, …])Constructor of the base operator.
add_input
(label, data_type, storage_type)add_output
(label, data_type, storage_type)compute
(op_input, op_output, context)Performs computation for this operator and handles I/O.
create_dicom_seg
(image, dicom_series, output_dir)Ensures that the operator is valid.
This method gets executed after “compute()” of an operator is called.
This method gets executed before compute() of an operator is called.
process_images
(image, …)select_input_file
(input_folder[, extensions])Select the input files based on supported extensions.
Attributes
DCM_EXTENSION
SUPPORTED_EXTENSIONS
Gives access to the environment.
Returns the name of this operator.
Retrieves the operator info.
Gives access to the UID of the operator.
- compute(op_input, op_output, context)[source]¶
Performs computation for this operator and handles I/O.
For now, only a single segmentation image object or file is supported and the selected DICOM series for inference is required, because the DICOM Seg IOD needs to refer to original instance. When there are multiple selected series in the input, the first series’ containing study will be used for retrieving DICOM Study module attributes, e.g. StudyInstanceUID.
- Raises
FileNotFoundError – When image object not in the input, and segmentation image file not found either.
ValueError – Neither image object nor image file’s folder is in the input, or no selected series.
- ensure_valid()¶
Ensures that the operator is valid.
This method needs to be executed by add_operator() and add_flow() methods in the compose() method of the application. This sets default values for the operator in the graph if necessary. (e.g., set default value for the operator’s input port, set default value for the operator’s output port, etc.)
- property env: monai.deploy.core.operator.OperatorEnv¶
Gives access to the environment.
This sets a default value for the operator’s environment if not set.
- Return type
OperatorEnv
- Returns
An instance of OperatorEnv.
- property name: str¶
Returns the name of this operator.
- Return type
str
- property op_info: monai.deploy.core.operator_info.OperatorInfo¶
Retrieves the operator info.
Args:
- Return type
OperatorInfo
- Returns
An instance of OperatorInfo.
- post_compute()¶
This method gets executed after “compute()” of an operator is called.
This is a post-execution step before the operator is done doing its main action. This needs to be overridden by a base class for any meaningful action.
- pre_compute()¶
This method gets executed before compute() of an operator is called.
This is a preperatory step before the operator executes its main job. This needs to be overridden by a base class for any meaningful action.
- select_input_file(input_folder, extensions=['.nii', '.nii.gz', '.mhd'])[source]¶
Select the input files based on supported extensions.
- Parameters
input_folder (string) – the path of the folder containing the input file(s)
extensions (array) – the supported file formats identified by the extensions.
- Returns
The path of the selected file ext (string): The extension of the selected file
- Return type
file_path (string)
- property uid: uuid.UUID¶
Gives access to the UID of the operator.
- Return type
UUID
- Returns
UID of the operator.