monai.deploy.operators.DICOMEncapsulatedPDFWriterOperator¶
- class monai.deploy.operators.DICOMEncapsulatedPDFWriterOperator(fragment, *args, output_folder, model_info, equipment_info=None, copy_tags=True, custom_tags=None, **kwargs)[source]¶
Bases:
holoscan.core.Operator
Class to write DICOM Encapsulated PDF Instance with provided PDF bytes in memory.
- Named inputs:
pdf_bytes: Bytes of the the PDF content. study_selected_series_list: Optional, DICOM series for copying metadata from.
- Named output:
None
- File output:
Generaed DICOM instance file in the provided output folder.
Class to write DICOM Encapsulated PDF Instance with PDF bytes in memory or in a file.
- Parameters
fragment (Fragment) – An instance of the Application class which is derived from Fragment.
output_folder (str or Path) – The folder for saving the generated DICOM instance file.
copy_tags (bool) – True, default, for copying DICOM attributes from a provided DICOMSeries. If True and no DICOMSeries obj provided, runtime exception is thrown.
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__
(fragment, *args, output_folder, …)Class to write DICOM Encapsulated PDF Instance with PDF bytes in memory or in a file.
add_arg
(*args, **kwargs)Overloaded function.
compute
(op_input, op_output, context)Performs computation for this operator and handles I/O.
Default implementation of initialize
resource
(self, name)Resources associated with the operator.
setup
(spec)Set up the named input(s), and output(s) if applicable.
start
()Default implementation of start
stop
()Default implementation of stop
write
(content_bytes, dicom_series, output_dir)Writes DICOM object
Attributes
DCM_EXTENSION
DEFAULT_OUTPUT_FOLDER
The list of arguments associated with the component.
Conditions associated with the operator.
YAML formatted string describing the operator.
The fragment (
holoscan.core.Fragment
) that the operator belongs to.The identifier of the component.
The name of the operator.
The operator type.
Resources associated with the operator.
The operator spec (
holoscan.core.OperatorSpec
) associated with the operator.- class OperatorType(self: holoscan.core._core.Operator.OperatorType, value: int) None ¶
Bases:
pybind11_builtins.pybind11_object
Enum class for operator types used by the executor.
NATIVE: Native operator.
GXF: GXF operator.
VIRTUAL: Virtual operator. (for internal use, not intended for use by application authors)
Members:
NATIVE
GXF
VIRTUAL
- property name¶
- __init__(fragment, *args, output_folder, model_info, equipment_info=None, copy_tags=True, custom_tags=None, **kwargs)[source]¶
Class to write DICOM Encapsulated PDF Instance with PDF bytes in memory or in a file.
- Parameters
fragment (Fragment) – An instance of the Application class which is derived from Fragment.
output_folder (str or Path) – The folder for saving the generated DICOM instance file.
copy_tags (bool) – True, default, for copying DICOM attributes from a provided DICOMSeries. If True and no DICOMSeries obj provided, runtime exception is thrown.
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.
- add_arg(*args, **kwargs)¶
Overloaded function.
add_arg(self: holoscan.core._core.Operator, arg: holoscan.core._core.Arg) -> None
Add an argument to the component.
add_arg(self: holoscan.core._core.Operator, arg: holoscan.core._core.ArgList) -> None
Add a list of arguments to the component.
add_arg(self: holoscan.core._core.Operator, **kwargs) -> None
Add arguments to the component via Python kwargs.
add_arg(self: holoscan.core._core.Operator, arg: holoscan.core._core.Condition) -> None
add_arg(self: holoscan.core._core.Operator, arg: holoscan.core._core.Resource) -> None
Add a condition or resource to the Operator.
This can be used to add a condition or resource to an operator after it has already been constructed.
- argholoscan.core.Condition or holoscan.core.Resource
The condition or resource to add.
- property args¶
The list of arguments associated with the component.
arglist : holoscan.core.ArgList
- 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
- property conditions¶
Conditions associated with the operator.
- property description¶
YAML formatted string describing the operator.
- property fragment¶
The fragment (
holoscan.core.Fragment
) that the operator belongs to.
- property id¶
The identifier of the component.
The identifier is initially set to
-1
, and will become a valid value when the component is initialized.With the default executor (holoscan.gxf.GXFExecutor), the identifier is set to the GXF component ID.
id : int
- initialize()¶
Default implementation of initialize
- property name¶
The name of the operator.
- property operator_type¶
The operator type.
holoscan.core.Operator.OperatorType enum representing the type of the operator. The two types currently implemented are native and GXF.
- resource(self: holoscan.core._core.Operator, name: str) Optional[object] ¶
Resources associated with the operator.
name : str The name of the resource to retrieve
- holoscan.core.Resource or None
The resource with the given name. If no resource with the given name is found, None is returned.
- property resources¶
Resources associated with the operator.
- setup(spec)[source]¶
Set up the named input(s), and output(s) if applicable.
This operator does not have an output for the next operator, rather file output only.
- Parameters
spec (OperatorSpec) – The Operator specification for inputs and outputs etc.
- property spec¶
The operator spec (
holoscan.core.OperatorSpec
) associated with the operator.
- start()¶
Default implementation of start
- stop()¶
Default implementation of stop