# HG changeset patch # User Sebastien Jodogne # Date 1566473702 -7200 # Node ID b9edca31124502473f0b0192a3e3c2330bf18a59 # Parent 442c6e3083ed150caed0d1bf07b70aef2d244de4 header allowing to retrieve a frame in its native transfer syntax diff -r 442c6e3083ed -r b9edca311245 Plugin/WadoRsRetrieveFrames.cpp --- 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 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))