Mercurial > hg > orthanc-gdcm
changeset 42:962307b99548
Temporarily prevent transcoding of 16bpp images to JPEG, as this might crash GDCM
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 03 Dec 2020 13:55:51 +0100 (2020-12-03) |
parents | 22bbf7b7e58d |
children | ff44174ede8a |
files | NEWS Plugin/Plugin.cpp |
diffstat | 2 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Fri Nov 06 17:56:05 2020 +0100 +++ b/NEWS Thu Dec 03 13:55:51 2020 +0100 @@ -1,6 +1,8 @@ Pending changes in the mainline =============================== +* Temporarily prevent transcoding of 16bpp images to JPEG, as this might crash GDCM + Version 1.1 (2020-08-05) ========================
--- a/Plugin/Plugin.cpp Fri Nov 06 17:56:05 2020 +0100 +++ b/Plugin/Plugin.cpp Thu Dec 03 13:55:51 2020 +0100 @@ -322,6 +322,18 @@ gdcm::TransferSyntax syntax(gdcm::TransferSyntax::GetTSType(allowedSyntaxes[i])); if (syntax.IsValid()) { + if (reader.GetImage().GetPixelFormat().GetBitsStored() == 16u && + syntax == gdcm::TransferSyntax::JPEGExtendedProcess2_4) + { + /** + * This is a temporary workaround for issue #513 in GDCM: + * https://sourceforge.net/p/gdcm/bugs/513/ + * https://groups.google.com/g/orthanc-users/c/xt9hwpj6mlQ + **/ + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented, + "Transcoding 16bit images to 1.2.840.10008.1.2.4.51 might lead to a crash in GDCM"); + } + gdcm::ImageChangeTransferSyntax change; change.SetTransferSyntax(syntax); change.SetInput(reader.GetImage());