diff OrthancServer/Sources/DicomInstanceToStore.cpp @ 4385:92737070b301

If meta-header is missing, best-effort to extract "TransferSyntax" in "/instances/{id}/metadata"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 18 Dec 2020 11:48:40 +0100
parents 0ddc5297a8ab
children d9473bd5ed43
line wrap: on
line diff
--- a/OrthancServer/Sources/DicomInstanceToStore.cpp	Fri Dec 18 11:13:00 2020 +0100
+++ b/OrthancServer/Sources/DicomInstanceToStore.cpp	Fri Dec 18 11:48:40 2020 +0100
@@ -373,6 +373,18 @@
           return true;
         }
       }
+      else
+      {
+        // This is a DICOM file without a proper meta-header. Fallback
+        // to DCMTK, which will fully parse the dataset to retrieve
+        // the transfer syntax. Added in Orthanc 1.8.2.
+        std::string transferSyntax;
+        if (GetParsedDicomFile().LookupTransferSyntax(transferSyntax))
+        {
+          result = Toolbox::StripSpaces(transferSyntax);
+          return true;
+        }
+      }
 
       return false;
     }