changeset 3464:418a89acef3b

In DICOM-to-DICOMweb/JSON conversion, be more tolerant wrt. invalid DICOM files
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Jul 2019 15:29:50 +0200
parents be2eeeaad86a
children 3f1f9039861b
files Core/DicomParsing/DicomWebJsonVisitor.cpp
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Core/DicomParsing/DicomWebJsonVisitor.cpp	Tue Jul 09 14:44:26 2019 +0200
+++ b/Core/DicomParsing/DicomWebJsonVisitor.cpp	Tue Jul 09 15:29:50 2019 +0200
@@ -653,7 +653,15 @@
             }
             catch (boost::bad_lexical_cast&)
             {
-              throw OrthancException(ErrorCode_BadFileFormat);
+              std::string tmp;
+              if (value.size() < 64 &&
+                  Toolbox::IsAsciiString(value))
+              {
+                tmp = ": " + value;
+              }
+              
+              LOG(WARNING) << "Ignoring DICOM tag (" << tag.Format()
+                           << ") with invalid content for VR " << EnumerationToString(vr) << tmp;
             }
           }
         }