comparison Core/DicomParsing/FromDcmtkBridge.cpp @ 3811:890af7156f19 transcoding

fix transcoding to jpeg baseline
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Apr 2020 08:40:30 +0200
parents a11d1d4b5849
children b40dfa6dc8da 37cf1889667a
comparison
equal deleted inserted replaced
3810:e9b7e05bcd42 3811:890af7156f19
1255 1255
1256 bool FromDcmtkBridge::SaveToMemoryBuffer(std::string& buffer, 1256 bool FromDcmtkBridge::SaveToMemoryBuffer(std::string& buffer,
1257 DcmDataset& dataSet) 1257 DcmDataset& dataSet)
1258 { 1258 {
1259 // Determine the transfer syntax which shall be used to write the 1259 // Determine the transfer syntax which shall be used to write the
1260 // information to the file. We always switch to the Little Endian 1260 // information to the file. If not possible, switch to the Little
1261 // syntax, with explicit length. 1261 // Endian syntax, with explicit length.
1262 1262
1263 // http://support.dcmtk.org/docs/dcxfer_8h-source.html 1263 // http://support.dcmtk.org/docs/dcxfer_8h-source.html
1264 1264
1265 1265
1266 /** 1266 /**
1316 if (!LookupDcmtkTransferSyntax(xfer, syntax)) 1316 if (!LookupDcmtkTransferSyntax(xfer, syntax))
1317 { 1317 {
1318 throw OrthancException(ErrorCode_InternalError); 1318 throw OrthancException(ErrorCode_InternalError);
1319 } 1319 }
1320 else 1320 else
1321 { 1321 {
1322 return (dicom.getDataset()->chooseRepresentation(xfer, representation).good() && 1322 if (!dicom.getDataset()->chooseRepresentation(xfer, representation).good() ||
1323 dicom.getDataset()->canWriteXfer(xfer) && 1323 !dicom.getDataset()->canWriteXfer(xfer) ||
1324 SaveToMemoryBufferInternal(buffer, dicom, xfer)); 1324 !dicom.validateMetaInfo(xfer, EWM_updateMeta).good())
1325 {
1326 return false;
1327 }
1328
1329 dicom.removeInvalidGroups();
1330
1331 return SaveToMemoryBufferInternal(buffer, dicom, xfer);
1325 } 1332 }
1326 } 1333 }
1327 1334
1328 1335
1329 ValueRepresentation FromDcmtkBridge::LookupValueRepresentation(const DicomTag& tag) 1336 ValueRepresentation FromDcmtkBridge::LookupValueRepresentation(const DicomTag& tag)