comparison OrthancServer/Sources/ServerContext.cpp @ 4203:4d42408da117

improving const-correctness in ParsedDicomFile
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 17 Sep 2020 15:01:31 +0200
parents 37310bb1cd30
children d962a2996637
comparison
equal deleted inserted replaced
4202:2007ab69ac16 4203:4d42408da117
1438 if (builtinDecoderTranscoderOrder_ == BuiltinDecoderTranscoderOrder_Before) 1438 if (builtinDecoderTranscoderOrder_ == BuiltinDecoderTranscoderOrder_Before)
1439 { 1439 {
1440 // Use Orthanc's built-in decoder, using the cache to speed-up 1440 // Use Orthanc's built-in decoder, using the cache to speed-up
1441 // things on multi-frame images 1441 // things on multi-frame images
1442 ServerContext::DicomCacheLocker locker(*this, publicId); 1442 ServerContext::DicomCacheLocker locker(*this, publicId);
1443 std::unique_ptr<ImageAccessor> decoded( 1443 std::unique_ptr<ImageAccessor> decoded(locker.GetDicom().DecodeFrame(frameIndex));
1444 DicomImageDecoder::Decode(locker.GetDicom(), frameIndex));
1445 if (decoded.get() != NULL) 1444 if (decoded.get() != NULL)
1446 { 1445 {
1447 return decoded.release(); 1446 return decoded.release();
1448 } 1447 }
1449 } 1448 }
1470 #endif 1469 #endif
1471 1470
1472 if (builtinDecoderTranscoderOrder_ == BuiltinDecoderTranscoderOrder_After) 1471 if (builtinDecoderTranscoderOrder_ == BuiltinDecoderTranscoderOrder_After)
1473 { 1472 {
1474 ServerContext::DicomCacheLocker locker(*this, publicId); 1473 ServerContext::DicomCacheLocker locker(*this, publicId);
1475 return DicomImageDecoder::Decode(locker.GetDicom(), frameIndex); 1474 return locker.GetDicom().DecodeFrame(frameIndex);
1476 } 1475 }
1477 else 1476 else
1478 { 1477 {
1479 return NULL; // Built-in decoder is disabled 1478 return NULL; // Built-in decoder is disabled
1480 } 1479 }
1484 ImageAccessor* ServerContext::DecodeDicomFrame(const DicomInstanceToStore& dicom, 1483 ImageAccessor* ServerContext::DecodeDicomFrame(const DicomInstanceToStore& dicom,
1485 unsigned int frameIndex) 1484 unsigned int frameIndex)
1486 { 1485 {
1487 if (builtinDecoderTranscoderOrder_ == BuiltinDecoderTranscoderOrder_Before) 1486 if (builtinDecoderTranscoderOrder_ == BuiltinDecoderTranscoderOrder_Before)
1488 { 1487 {
1489 std::unique_ptr<ImageAccessor> decoded( 1488 std::unique_ptr<ImageAccessor> decoded(dicom.GetParsedDicomFile().DecodeFrame(frameIndex));
1490 DicomImageDecoder::Decode(dicom.GetParsedDicomFile(), frameIndex));
1491 if (decoded.get() != NULL) 1489 if (decoded.get() != NULL)
1492 { 1490 {
1493 return decoded.release(); 1491 return decoded.release();
1494 } 1492 }
1495 } 1493 }
1512 } 1510 }
1513 #endif 1511 #endif
1514 1512
1515 if (builtinDecoderTranscoderOrder_ == BuiltinDecoderTranscoderOrder_After) 1513 if (builtinDecoderTranscoderOrder_ == BuiltinDecoderTranscoderOrder_After)
1516 { 1514 {
1517 return DicomImageDecoder::Decode(dicom.GetParsedDicomFile(), frameIndex); 1515 return dicom.GetParsedDicomFile().DecodeFrame(frameIndex);
1518 } 1516 }
1519 else 1517 else
1520 { 1518 {
1521 return NULL; 1519 return NULL;
1522 } 1520 }