Skip to content

Commit 7aa5901

Browse files
committed
PatientPosition tag check
Signed-off-by: bluna301 <[email protected]>
1 parent 456c3b0 commit 7aa5901

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

monai/deploy/operators/dicom_series_selector_operator.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def _select_series(
257257
List of DICOMSeries. At most one element if all_matched is False.
258258
259259
Raises:
260-
NotImplementedError: If the value_to_match type is not supported for matching.
260+
NotImplementedError: If the value_to_match type is not supported for matching or unsupported PatientPosition value.
261261
"""
262262
assert isinstance(attributes, dict), '"attributes" must be a dict.'
263263

@@ -304,6 +304,13 @@ def _select_series(
304304
matched = False
305305
# Image orientation check
306306
elif key == "ImageOrientationPatient":
307+
patient_position = series_attr.get("PatientPosition")
308+
if patient_position is None:
309+
raise NotImplementedError(
310+
"PatientPosition tag absent; value required for image orientation calculation"
311+
)
312+
if patient_position not in ("HFP", "HFS", "HFDL", "HFDR", "FFP", "FFS", "FFDL", "FFDR"):
313+
raise NotImplementedError(f"No support for PatientPosition value {patient_position}")
307314
matched = self._match_image_orientation(value_to_match, attr_value)
308315
elif isinstance(attr_value, (float, int)):
309316
matched = self._match_numeric_condition(value_to_match, attr_value)
@@ -413,6 +420,15 @@ def _match_numeric_condition(self, value_to_match, attr_value):
413420
def _match_image_orientation(self, value_to_match, attr_value):
414421
"""
415422
Helper method to calculate and match the image orientation using the ImageOrientationPatient tag.
423+
The following PatientPosition values are supported and have been tested:
424+
- "HFP"
425+
- "HFS"
426+
- "HFDL"
427+
- "HFDR"
428+
- "FFP"
429+
- "FFS"
430+
- "FFDL"
431+
- "FFDR"
416432
417433
Supported image orientation inputs for matching (case-insensitive):
418434
- "Axial"

0 commit comments

Comments
 (0)