comparison Core/DicomParsing/DcmtkTranscoder.cpp @ 3909:6762a97deabc transcoding

removed useless abstraction IDicomTranscoder::TranscodeToBuffer()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 08 May 2020 11:40:12 +0200
parents 1555feda39e2
children 1f71c2f20e16
comparison
equal deleted inserted replaced
3908:89ebb37cee6a 3909:6762a97deabc
288 288
289 return false; 289 return false;
290 } 290 }
291 291
292 292
293 bool DcmtkTranscoder::TranscodeToBuffer(std::string& target,
294 bool& hasSopInstanceUidChanged /* out */,
295 const void* buffer,
296 size_t size,
297 const std::set<DicomTransferSyntax>& allowedSyntaxes,
298 bool allowNewSopInstanceUid)
299 {
300 std::unique_ptr<DcmFileFormat> dicom(FromDcmtkBridge::LoadFromMemoryBuffer(buffer, size));
301 if (dicom.get() == NULL)
302 {
303 throw OrthancException(ErrorCode_BadFileFormat);
304 }
305
306 std::unique_ptr<TranscodedDicom> transcoded(
307 TranscodeToParsed(*dicom, buffer, size, allowedSyntaxes, allowNewSopInstanceUid));
308
309 if (transcoded.get() == NULL)
310 {
311 return false;
312 }
313 else
314 {
315 if (transcoded->GetDicom().getDataset() == NULL)
316 {
317 throw OrthancException(ErrorCode_InternalError);
318 }
319
320 FromDcmtkBridge::SaveToMemoryBuffer(target, *transcoded->GetDicom().getDataset());
321 return true;
322 }
323 }
324
325
326 bool DcmtkTranscoder::IsSupported(DicomTransferSyntax syntax) 293 bool DcmtkTranscoder::IsSupported(DicomTransferSyntax syntax)
327 { 294 {
328 if (syntax == DicomTransferSyntax_LittleEndianImplicit || 295 if (syntax == DicomTransferSyntax_LittleEndianImplicit ||
329 syntax == DicomTransferSyntax_LittleEndianExplicit || 296 syntax == DicomTransferSyntax_LittleEndianExplicit ||
330 syntax == DicomTransferSyntax_BigEndianExplicit || 297 syntax == DicomTransferSyntax_BigEndianExplicit ||