monai.deploy.operators.DICOMSeriesSelectorOperator¶
- class monai.deploy.operators.DICOMSeriesSelectorOperator(fragment, *args, rules='', all_matched=False, **kwargs)[source]¶
Bases:
holoscan.core.Operator
This operator selects a list of DICOM Series in a DICOM Study for a given set of selection rules.
- Named input:
dicom_study_list: A list of DICOMStudy objects.
- Named output:
study_selected_series_list: A list of StudySelectedSeries objects. Downstream receiver optional.
This class can be considered a base class, and a derived class can override the ‘filer’ function to with custom logics.
- In its default implementation, this class
selects a series or all matched series within the scope of a study in a list of studies
uses rules defined in JSON string, see below for details
supports DICOM Study and Series module attribute matching, including regex for string types
supports multiple named selections, in the scope of each DICOM study
outputs a list of SutdySelectedSeries objects, as well as a flat list of SelectedSeries (to be deprecated)
- The selection rules are defined in JSON,
attribute “selections” value is a list of selections
each selection has a “name”, and its “conditions” value is a list of matching criteria
each condition has uses the implicit equal operator, except for regex for str type and union for set type
DICOM attribute keywords are used, and only for those defined as DICOMStudy and DICOMSeries properties
An example selection rules: {
- “selections”: [
- {
“name”: “CT Series 1”, “conditions”: {
“StudyDescription”: “(?i)^Spleen”, “Modality”: “(?i)CT”, “SeriesDescription”: “(?i)^No series description|(.*?)”
}
}, {
“name”: “CT Series 2”, “conditions”: {
“Modality”: “CT”, “BodyPartExamined”: “Abdomen”, “SeriesDescription” : “Not to be matched. For illustration only.”
}
}
]
}
Instantiate an instance.
- Parameters
fragment (Fragment) – An instance of the Application class which is derived from Fragment.
rules (Text) – Selection rules in JSON string.
all_matched (bool) – Gets all matched series in a study. Defaults to False for first match only.
Methods
__init__
(fragment, *args[, rules, all_matched])Instantiate an instance.
add_arg
(*args, **kwargs)Overloaded function.
compute
(op_input, op_output, context)Performs computation for this operator.
filter
(selection_rules, dicom_study_list[, …])Selects the series with the given matching rules.
Default implementation of initialize
resource
(self, name)Resources associated with the operator.
setup
(spec)Default implementation of setup method.
start
()Default implementation of start
stop
()Default implementation of stop
Attributes
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, rules='', all_matched=False, **kwargs)[source]¶
Instantiate an instance.
- Parameters
fragment (Fragment) – An instance of the Application class which is derived from Fragment.
rules (Text) – Selection rules in JSON string.
all_matched (bool) – Gets all matched series in a study. Defaults to False for first match only.
- 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
- property conditions¶
Conditions associated with the operator.
- property description¶
YAML formatted string describing the operator.
- filter(selection_rules, dicom_study_list, all_matched=False)[source]¶
Selects the series with the given matching rules.
If rules object is None, all series will be returned with series instance UID as the selection name.
- Simplistic matching is used for demonstration:
Number: exactly matches String: matches case insensitive, if fails then tries RegEx search String array matches as subset, case insensitive
- Parameters
selection_rules (object) – JSON object containing the matching rules.
dicom_study_list (list) – A list of DICOMStudiy objects.
all_matched (bool) – Gets all matched series in a study. Defaults to False for first match only.
- Returns
A list of objects of type StudySelectedSeries.
- Return type
list
- Raises
ValueError – If the selection_rules object does not contain “selections” attribute.
- 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.
- property spec¶
The operator spec (
holoscan.core.OperatorSpec
) associated with the operator.
- start()¶
Default implementation of start
- stop()¶
Default implementation of stop