changeset 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 7266c37d0354
children 5405d36e9d48
files Core/DicomFormat/DicomInstanceHasher.cpp Core/DicomFormat/DicomMap.h NEWS
diffstat 3 files changed, 7 insertions(+), 3 deletions(-) [+]
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());
--- a/Core/DicomFormat/DicomMap.h	Thu Nov 20 11:58:47 2014 +0100
+++ b/Core/DicomFormat/DicomMap.h	Fri Nov 21 09:12:38 2014 +0100
@@ -125,11 +125,13 @@
 
     const DicomValue& GetValue(const DicomTag& tag) const;
 
+    // DO NOT delete the returned value!
     const DicomValue* TestAndGetValue(uint16_t group, uint16_t element) const
     {
       return TestAndGetValue(DicomTag(group, element));
     }       
 
+    // DO NOT delete the returned value!
     const DicomValue* TestAndGetValue(const DicomTag& tag) const;
 
     void Remove(const DicomTag& tag);
--- a/NEWS	Thu Nov 20 11:58:47 2014 +0100
+++ b/NEWS	Fri Nov 21 09:12:38 2014 +0100
@@ -1,6 +1,7 @@
 Pending changes in the mainline
 ===============================
 
+* Instances without PatientID are now allowed
 
 
 Version 0.8.5 (2014/11/04)