monai.deploy.operators.DICOMDataLoaderOperator¶
- class monai.deploy.operators.DICOMDataLoaderOperator(must_load=True, *args, **kwargs)[source]¶
Bases:
monai.deploy.core.operator.Operator
This operator loads a collection of DICOM Studies in memory given a directory which contains a list of SOP Instances.
Creates an instance of this class
- Parameters
must_load (bool) – If true, raise exception if no study is loaded. Defaults to True.
Methods
__init__
([must_load])Creates an instance of this class
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 handlesI/O.
Ensures that the operator is valid.
load_data_to_studies
(input_path)Load DICOM data from files into DICOMStudy objects in a list.
populate_series_attributes
(series, sop_instance)Populates series level attributes in the study data structure.
populate_study_attributes
(study, sop_instance)Populates study level attributes in the study data structure.
This method gets executed after “compute()” of an operator is called.
This method gets executed before compute() of an operator is called.
Attributes
Gives access to the environment.
Returns the name of this operator.
Retrieves the operator info.
Gives access to the UID of the operator.
- __init__(must_load=True, *args, **kwargs)[source]¶
Creates an instance of this class
- Parameters
must_load (bool) – If true, raise exception if no study is loaded. Defaults to True.
- compute(op_input, op_output, context)[source]¶
Performs computation for this operator and handlesI/O.
- 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.
- load_data_to_studies(input_path)[source]¶
Load DICOM data from files into DICOMStudy objects in a list.
It scans through the input directory for all SOP instances. It groups them by a collection of studies where each study contains one or more series. This method returns a list of studies. If there is no studies loaded, an exception will be thrown if set to must load.
- Parameters
input_path (Path) – The folder containing DICOM instance files.
- Returns
List of DICOMStudy.
- Return type
List[DICOMStudy]
- Raises
ValueError – If the folder to load files from does not exist.
ItemNotExistsError – If no studies loaded and must_load is True.
- 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.
- populate_series_attributes(series, sop_instance)[source]¶
Populates series level attributes in the study data structure.
- Parameters
study – A DICOM Series instance that needs to be filled-in with series level attribute values
sop_instance – A sample DICOM SOP Instance that contains the list of attributed which will be parsed
- populate_study_attributes(study, sop_instance)[source]¶
Populates study level attributes in the study data structure.
- Parameters
study – A DICOM Study instance that needs to be filled-in with study level attribute values
sop_instance – A sample DICOM SOP Instance that contains the list of attributed which will be parsed
- 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.