Mercurial > hg > orthanc
changeset 5283:57c0fba5e5c7
fix decoding of YBR_FULL RLE images with PlanarConfiguration=1
author | Alain Mazy <am@osimis.io> |
---|---|
date | Fri, 21 Apr 2023 10:35:07 +0200 |
parents | 13815a13b5c9 |
children | 56cd3444a2d8 |
files | NEWS OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp |
diffstat | 2 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Mon Apr 17 08:56:43 2023 +0200 +++ b/NEWS Fri Apr 21 10:35:07 2023 +0200 @@ -1,6 +1,12 @@ Pending changes in the mainline =============================== +Maintenance +----------- + +* Fix decoding of YBR_FULL RLE images for which the "Planar Configuration" + tag (0028,0006) equals 1 + Version 1.12.0 (2023-04-14) ===========================
--- a/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp Mon Apr 17 08:56:43 2023 +0200 +++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp Fri Apr 21 10:35:07 2023 +0200 @@ -745,11 +745,20 @@ "Cannot decode a non-palette image"); } + std::string colorModel = Orthanc::Toolbox::StripSpaces(decompressedColorModel.c_str()); + if (target->GetFormat() == PixelFormat_RGB24 && - Orthanc::Toolbox::StripSpaces(decompressedColorModel.c_str()) == "RGB" && + (colorModel == "RGB" || colorModel == "YBR_FULL") && info.IsPlanar()) { - return DecodePlanarConfiguration(*target); + std::unique_ptr<ImageAccessor> output(DecodePlanarConfiguration(*target)); + + if (colorModel == "YBR_FULL") + { + ImageProcessing::ConvertJpegYCbCrToRgb(*output); + } + + return output.release(); } else {