changeset 3368:3cd94bc66731

allow creating ParsedDicomFile with empty DICOM elements
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 14 May 2019 09:30:09 +0200
parents b0b5852622e4
children 20b38a533254
files Core/DicomParsing/ParsedDicomFile.cpp
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Core/DicomParsing/ParsedDicomFile.cpp	Mon May 13 16:15:02 2019 +0200
+++ b/Core/DicomParsing/ParsedDicomFile.cpp	Tue May 14 09:30:09 2019 +0200
@@ -771,9 +771,12 @@
 
       std::auto_ptr<DcmElement> element(FromDcmtkBridge::CreateElementForTag(tag));
 
-      bool hasCodeExtensions;
-      Encoding encoding = DetectEncoding(hasCodeExtensions);
-      FromDcmtkBridge::FillElementWithString(*element, tag, utf8Value, decodeDataUriScheme, encoding);
+      if (!utf8Value.empty())
+      {
+        bool hasCodeExtensions;
+        Encoding encoding = DetectEncoding(hasCodeExtensions);
+        FromDcmtkBridge::FillElementWithString(*element, tag, utf8Value, decodeDataUriScheme, encoding);
+      }
 
       InsertInternal(dicom, element.release());
       UpdateStorageUid(tag, utf8Value, false);