changeset 347:b9edca311245

header allowing to retrieve a frame in its native transfer syntax
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 22 Aug 2019 13:35:02 +0200
parents 442c6e3083ed
children d4a535ebd88c
files Plugin/WadoRsRetrieveFrames.cpp
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Plugin/WadoRsRetrieveFrames.cpp	Thu Aug 22 07:51:43 2019 +0200
+++ b/Plugin/WadoRsRetrieveFrames.cpp	Thu Aug 22 13:35:02 2019 +0200
@@ -62,7 +62,8 @@
 
 
 
-static gdcm::TransferSyntax ParseTransferSyntax(const OrthancPluginHttpRequest* request)
+static gdcm::TransferSyntax ParseTransferSyntax(const OrthancPluginHttpRequest* request,
+                                                gdcm::TransferSyntax sourceTransferSyntax)
 {
   for (uint32_t i = 0; i < request->headersCount; i++)
   {
@@ -117,6 +118,11 @@
         {
           return gdcm::TransferSyntax(gdcm::TransferSyntax::ImplicitVRLittleEndian);
         }
+        else if (transferSyntax == "*")
+        {
+          // New in DICOMweb plugin 1.1.0
+          return sourceTransferSyntax;
+        }
         else
         {
           throw Orthanc::OrthancException(
@@ -285,11 +291,13 @@
 static const char* GetMimeType(const gdcm::TransferSyntax& syntax)
 {
   // http://dicom.nema.org/medical/dicom/current/output/html/part18.html#table_6.1.1.8-3b
-  
+  // http://dicom.nema.org/MEDICAL/dicom/2019a/output/chtml/part18/chapter_6.html#table_6.1.1.8-3b
+
   switch (syntax)
   {
     case gdcm::TransferSyntax::ImplicitVRLittleEndian:
-      return "application/octet-stream";
+      // The "transfer-syntax" info was added in version 1.1 of the plugin
+      return "application/octet-stream; transfer-syntax=1.2.840.10008.1.2.1";
 
     case gdcm::TransferSyntax::JPEGBaselineProcess1:
       return "image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.50";
@@ -486,8 +494,6 @@
                     const char* url,
                     const OrthancPluginHttpRequest* request)
 {
-  gdcm::TransferSyntax targetSyntax(ParseTransferSyntax(request));
-
   std::list<unsigned int> frames;
   ParseFrameList(frames, request);
 
@@ -524,6 +530,8 @@
       sourceSyntax = source->GetFile().GetHeader().GetDataSetTransferSyntax();
     }
 
+    gdcm::TransferSyntax targetSyntax(ParseTransferSyntax(request, sourceSyntax));
+
     if (sourceSyntax == targetSyntax ||
         (targetSyntax == gdcm::TransferSyntax::ImplicitVRLittleEndian &&
          sourceSyntax == gdcm::TransferSyntax::ExplicitVRLittleEndian))