monai.deploy.operators.DICOMEncapsulatedPDFWriterOperator¶
- class monai.deploy.operators.DICOMEncapsulatedPDFWriterOperator(copy_tags, model_info, equipment_info=None, custom_tags=None, *args, **kwargs)[source]¶
Bases:
monai.deploy.core.operator.Operator
Class to write DICOM Encapsulated PDF Instance with PDF bytes in memory or in a file.
- Parameters
copy_tags (bool) – True for copying DICOM attributes from a provided DICOMSeries.
model_info (ModelInfo) – Object encapsulating model creator, name, version and UID.
equipment_info (EquipmentInfo, optional) – Object encapsulating info for DICOM Equipment Module. Defaults to None.
custom_tags (Dict[str, str], optional) – Dictionary for setting custom DICOM tags using Keywords and str values only. Defaults to None.
- Raises
ValueError – If copy_tags is true and no DICOMSeries object provided, or if PDF bytes cannot be found in memory or loaded from the file.
Methods
__init__
(copy_tags, model_info[, …])Class to write DICOM Encapsulated PDF Instance with PDF bytes in memory or in a file.
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.
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.
write
(content_bytes, dicom_series, output_dir)Writes DICOM object
Attributes
DCM_EXTENSION
Gives access to the environment.
Returns the name of this operator.
Retrieves the operator info.
Gives access to the UID of the operator.
- __init__(copy_tags, model_info, equipment_info=None, custom_tags=None, *args, **kwargs)[source]¶
Class to write DICOM Encapsulated PDF Instance with PDF bytes in memory or in a file.
- Parameters
copy_tags (bool) – True for copying DICOM attributes from a provided DICOMSeries.
model_info (ModelInfo) – Object encapsulating model creator, name, version and UID.
equipment_info (EquipmentInfo, optional) – Object encapsulating info for DICOM Equipment Module. Defaults to None.
custom_tags (Dict[str, str], optional) – Dictionary for setting custom DICOM tags using Keywords and str values only. Defaults to None.
- Raises
ValueError – If copy_tags is true and no DICOMSeries object provided, or if PDF bytes cannot be found in memory or loaded from the file.
- compute(op_input, op_output, context)[source]¶
Performs computation for this operator and handles I/O.
For now, only a single result content is supported, which could be in bytes or a path to the PDF file. The DICOM series used during inference is optional, but is required if the copy_tags is true indicating the generated DICOM object needs to copy study level metadata.
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 bytes are not in the input, and the file is not given or found.
ValueError – Input bytes and PDF file not in the input, or no DICOM series when required.
IOError – If fails to get the bytes of the PDF
- 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.
- property uid: uuid.UUID¶
Gives access to the UID of the operator.
- Return type
UUID
- Returns
UID of the operator.