diff OrthancServer/FromDcmtkBridge.cpp @ 311:26efccdff583

anonymisation
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 21 Dec 2012 12:44:32 +0100
parents fbf2b2282086
children fc856d175d18
line wrap: on
line diff
--- a/OrthancServer/FromDcmtkBridge.cpp	Fri Dec 21 11:18:27 2012 +0100
+++ b/OrthancServer/FromDcmtkBridge.cpp	Fri Dec 21 12:44:32 2012 +0100
@@ -572,7 +572,8 @@
     {
       DcmElement* element = dataset.getElement(i);
       DcmTag tag(element->getTag());
-      if (tag.getPrivateCreator() != NULL)
+      if (!strcmp("PrivateCreator", tag.getTagName()) ||  // TODO - This may change with future versions of DCMTK
+          tag.getPrivateCreator() != NULL)
       {
         privateTags.push_back(element);
       }
@@ -1278,17 +1279,10 @@
     switch (level)
     {
       case DicomRootLevel_Patient:
-      {
-        std::string uuid = Toolbox::GenerateUuid();
-        std::string id;
-        id.reserve(uuid.size());
-        for (size_t i = 0; i < uuid.size() && i < 8; i++)
-        {
-          id.push_back(toupper(uuid[i]));
-        }
-
-        return id;
-      }
+        // The "PatientID" field is of type LO (Long String), 64
+        // Bytes Maximum. An UUID is of length 36, thus it can be used
+        // as a random PatientID.
+        return Toolbox::GenerateUuid();
 
       case DicomRootLevel_Instance:
         return dcmGenerateUniqueIdentifier(uid, SITE_INSTANCE_UID_ROOT);