monai.deploy.operators.DICOMSeriesSelectorOperator¶
- class monai.deploy.operators.DICOMSeriesSelectorOperator(fragment, *args, rules='', all_matched=False, sort_by_sop_instance_count=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 ‘filter’ 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
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 uses the implicit equal operator; in addition, the following are supported:
regex and range matching for float and int types
regex matching for str type
union matching 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.”
}
}, {
“name”: “CT Series 3”, “conditions”: {
“StudyDescription”: “(.*?)”, “Modality”: “(?i)CT”, “ImageType”: [“PRIMARY”, “ORIGINAL”, “AXIAL”], “SliceThickness”: [3, 5]
}
}
]
}
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.
sort_by_sop_instance_count (bool) – If all_matched = True and multiple series are matched, sorts the matched series in
# (descending SOP instance count (i.e. the first Series in the returned List[StudySelectedSeries] will have the highest) –
sorting. (of DICOM images); Defaults to False for no) –
Methods
__init__
(fragment, *args[, rules, …])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.
Boolean indicating whether the fragment this operator belongs to has metadata transmission enabled.
The metadata dictionary (
holoscan.core.MetadataDictionary
) associated with the operator.The metadata dictionary (
holoscan.core.MetadataPolicy
) associated with the operator.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, sort_by_sop_instance_count=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.
sort_by_sop_instance_count (bool) – If all_matched = True and multiple series are matched, sorts the matched series in
# (descending SOP instance count (i.e. the first Series in the returned List[StudySelectedSeries] will have the highest) –
sorting. (of DICOM images); Defaults to False for no) –
- 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, sort_by_sop_instance_count=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.
- Supported matching logic:
Float + Int: exact matching, range matching (if a list with two numerical elements is provided), and regex matching String: matches case insensitive, if fails then tries RegEx search String array (set): matches as subset, case insensitive
- Parameters
selection_rules (object) – JSON object containing the matching rules.
dicom_study_list (list) – A list of DICOMStudy objects.
all_matched (bool) – Gets all matched series in a study. Defaults to False for first match only.
sort_by_sop_instance_count (bool) – If all_matched = True and multiple series are matched, sorts the matched series in
# (descending SOP instance count (i.e. the first Series in the returned List[StudySelectedSeries] will have the highest) –
sorting. (of DICOM images); Defaults to False for no) –
- 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 is_metadata_enabled¶
Boolean indicating whether the fragment this operator belongs to has metadata transmission enabled.
- property metadata¶
The metadata dictionary (
holoscan.core.MetadataDictionary
) associated with the operator.
- property metadata_policy¶
The metadata dictionary (
holoscan.core.MetadataPolicy
) associated with the operator.
- 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