# HG changeset patch # User Sebastien Jodogne # Date 1586241630 -7200 # Node ID 890af7156f1977ef44cad708bd103731827b6ed2 # Parent e9b7e05bcd421465d8f9649bd7366266f431ec2b fix transcoding to jpeg baseline diff -r e9b7e05bcd42 -r 890af7156f19 Core/DicomParsing/FromDcmtkBridge.cpp --- a/Core/DicomParsing/FromDcmtkBridge.cpp Mon Apr 06 12:36:49 2020 +0200 +++ b/Core/DicomParsing/FromDcmtkBridge.cpp Tue Apr 07 08:40:30 2020 +0200 @@ -1257,8 +1257,8 @@ DcmDataset& dataSet) { // Determine the transfer syntax which shall be used to write the - // information to the file. We always switch to the Little Endian - // syntax, with explicit length. + // information to the file. If not possible, switch to the Little + // Endian syntax, with explicit length. // http://support.dcmtk.org/docs/dcxfer_8h-source.html @@ -1318,10 +1318,17 @@ throw OrthancException(ErrorCode_InternalError); } else - { - return (dicom.getDataset()->chooseRepresentation(xfer, representation).good() && - dicom.getDataset()->canWriteXfer(xfer) && - SaveToMemoryBufferInternal(buffer, dicom, xfer)); + { + if (!dicom.getDataset()->chooseRepresentation(xfer, representation).good() || + !dicom.getDataset()->canWriteXfer(xfer) || + !dicom.validateMetaInfo(xfer, EWM_updateMeta).good()) + { + return false; + } + + dicom.removeInvalidGroups(); + + return SaveToMemoryBufferInternal(buffer, dicom, xfer); } }