# HG changeset patch # User Sebastien Jodogne # Date 1544720279 -3600 # Node ID 8812b1e27f247c0dcd50adb8f70843de976eae21 # Parent af1530b452907844f077c59998b2b69f40287b27# Parent 750de70b3603edf53e6309cdf2fcceb48ce1dd47 merge diff -r af1530b45290 -r 8812b1e27f24 Core/DicomFormat/DicomImageInformation.cpp --- a/Core/DicomFormat/DicomImageInformation.cpp Thu Dec 13 17:54:06 2018 +0100 +++ b/Core/DicomFormat/DicomImageInformation.cpp Thu Dec 13 17:57:59 2018 +0100 @@ -20,7 +20,7 @@ * you do not wish to do so, delete this exception statement from your * version. If you delete this exception statement from all source files * in the program, then also delete it here. - * + * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -195,17 +195,23 @@ numberOfFrames_ = 1; } - if ((bitsAllocated_ != 8 && bitsAllocated_ != 16 && - bitsAllocated_ != 24 && bitsAllocated_ != 32) || - numberOfFrames_ == 0 || - (planarConfiguration != 0 && planarConfiguration != 1)) + if (bitsAllocated_ != 8 && bitsAllocated_ != 16 && + bitsAllocated_ != 24 && bitsAllocated_ != 32) { - throw OrthancException(ErrorCode_NotImplemented); + throw OrthancException(ErrorCode_IncompatibleImageFormat, "Image not supported: " + boost::lexical_cast(bitsAllocated_) + " bits allocated"); + } + else if (numberOfFrames_ == 0) + { + throw OrthancException(ErrorCode_IncompatibleImageFormat, "Image not supported (no frames)"); + } + else if (planarConfiguration != 0 && planarConfiguration != 1) + { + throw OrthancException(ErrorCode_IncompatibleImageFormat, "Image not supported: planar configuration is " + boost::lexical_cast(planarConfiguration)); } if (samplesPerPixel_ == 0) { - throw OrthancException(ErrorCode_NotImplemented); + throw OrthancException(ErrorCode_IncompatibleImageFormat, "Image not supported: samples per pixel is 0"); } bytesPerValue_ = bitsAllocated_ / 8; @@ -279,8 +285,8 @@ } } - if (GetBitsStored() == 8 && - GetChannelCount() == 3 && + if (GetBitsStored() == 8 && + GetChannelCount() == 3 && !IsSigned() && (ignorePhotometricInterpretation || photometric_ == PhotometricInterpretation_RGB)) { @@ -294,9 +300,9 @@ size_t DicomImageInformation::GetFrameSize() const { - return (GetHeight() * - GetWidth() * - GetBytesPerValue() * + return (GetHeight() * + GetWidth() * + GetBytesPerValue() * GetChannelCount()); } }