diff Core/DicomParsing/DicomDirWriter.cpp @ 2421:d0fe5ec7eb05

playing with dicomdir
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 08 Oct 2017 11:13:56 +0200
parents 7284093111b0
children b340f0a9022c
line wrap: on
line diff
--- a/Core/DicomParsing/DicomDirWriter.cpp	Fri Oct 06 17:26:34 2017 +0200
+++ b/Core/DicomParsing/DicomDirWriter.cpp	Sun Oct 08 11:13:56 2017 +0200
@@ -211,6 +211,13 @@
       std::string value;
       bool found = GetUtf8TagValue(value, source, encoding, key);
 
+      if (!found)
+      {
+        // We don't raise an exception if "!optional", even if this
+        // results in an invalid DICOM file
+        value.clear();
+      }
+
       SetTagValue(target, key, value);
       return found;
     }
@@ -240,6 +247,14 @@
       CopyString(target, source, encoding, key, false, true);
     }
 
+    static void CopyStringType3(DcmDirectoryRecord& target,
+                                DcmDataset& source,
+                                Encoding encoding,
+                                const DcmTagKey& key)
+    {
+      CopyString(target, source, encoding, key, true, true);
+    }
+
 
   public:
     PImpl() : fileSetId_("ORTHANC_MEDIA")