Mercurial > hg > orthanc
changeset 4446:19e8540064d8
ImageProcessing::Set(image, r, g, b, a) applicable to grayscale images
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 13 Jan 2021 17:13:42 +0100 |
parents | 5e6b5fef92f8 |
children | 8421b3fc02d7 |
files | OrthancFramework/Sources/Images/ImageProcessing.cpp |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/Sources/Images/ImageProcessing.cpp Wed Jan 13 10:32:34 2021 +0100 +++ b/OrthancFramework/Sources/Images/ImageProcessing.cpp Wed Jan 13 17:13:42 2021 +0100 @@ -1080,6 +1080,16 @@ switch (image.GetFormat()) { + case PixelFormat_Grayscale8: + { + // New in Orthanc 1.9.0 + uint8_t grayscale = (2126 * static_cast<uint16_t>(red) + + 7152 * static_cast<uint16_t>(green) + + 0722 * static_cast<uint16_t>(blue)) / 10000; + Orthanc::ImageProcessing::Set(image, grayscale); + break; + } + case PixelFormat_RGBA32: p[0] = red; p[1] = green;