Skip to content

Commit

Permalink
logging the UID, if present, of the ignored instance
Browse files Browse the repository at this point in the history
Signed-off-by: M Q <mingmelvinq@nvidia.com>
  • Loading branch information
MMelQin committed Apr 24, 2024
1 parent ec3094c commit 991c7e7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions monai/deploy/operators/dicom_data_loader_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,15 @@ def _load_data(self, files: List[str]):
study_instance_uid = sop_instance[0x0020, 0x000D].value.name # name is the UID as str

# First need to eliminate the SOP instances whose SOP Class is to be ignored.
if "SOPInstanceUID" not in sop_instance:
self._logger.warn("Instance ignored due to missing SOP instance UID tag")
continue
sop_instance_uid = sop_instance["SOPInstanceUID"].value
if "SOPClassUID" not in sop_instance:
self._logger.warn("Instance ignored due to missing SOP Class UID tag.")
self._logger.warn(f"Instance ignored due to missing SOP Class UID tag, {sop_instance_uid}")
continue
if sop_instance["SOPClassUID"].value in DICOMDataLoaderOperator.SOP_CLASSES_TO_IGNORE:
self._logger.warn("Instance ignored due to its class in SOP_CLASSES_TO_IGNORE list.")
self._logger.warn(f"Instance ignored for being in the ignored class, {sop_instance_uid}")
continue

if study_instance_uid not in study_dict:
Expand Down

0 comments on commit 991c7e7

Please sign in to comment.