diff Core/DicomFormat/DicomInstanceHasher.cpp @ 1228:e0f7014d39a4

Instances without PatientID are now allowed
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 21 Nov 2014 09:12:38 +0100
parents a811bdf8b8eb
children 6e7e5ed91c2d
line wrap: on
line diff
--- a/Core/DicomFormat/DicomInstanceHasher.cpp	Thu Nov 20 11:58:47 2014 +0100
+++ b/Core/DicomFormat/DicomInstanceHasher.cpp	Fri Nov 21 09:12:38 2014 +0100
@@ -48,8 +48,7 @@
     seriesUid_ = seriesUid;
     instanceUid_ = instanceUid;
 
-    if (patientId_.size() == 0 ||
-        studyUid_.size() == 0 ||
+    if (studyUid_.size() == 0 ||
         seriesUid_.size() == 0 ||
         instanceUid_.size() == 0)
     {
@@ -59,7 +58,9 @@
 
   DicomInstanceHasher::DicomInstanceHasher(const DicomMap& instance)
   {
-    Setup(instance.GetValue(DICOM_TAG_PATIENT_ID).AsString(),
+    const DicomValue* patientId = instance.TestAndGetValue(DICOM_TAG_PATIENT_ID);
+
+    Setup(patientId == NULL ? "" : patientId->AsString(),
           instance.GetValue(DICOM_TAG_STUDY_INSTANCE_UID).AsString(),
           instance.GetValue(DICOM_TAG_SERIES_INSTANCE_UID).AsString(),
           instance.GetValue(DICOM_TAG_SOP_INSTANCE_UID).AsString());