# HG changeset patch # User Sebastien Jodogne # Date 1516292601 -3600 # Node ID 88bca952cb1783615a4f19e6876ad0cbc08a65e2 # Parent 2115530d37032c1e25a34d1073b67d9a364d413e ImageBuffer3D::GetPixelGrayscale8 diff -r 2115530d3703 -r 88bca952cb17 Framework/Enumerations.h --- a/Framework/Enumerations.h Thu Jan 18 14:42:33 2018 +0100 +++ b/Framework/Enumerations.h Thu Jan 18 17:23:21 2018 +0100 @@ -63,7 +63,9 @@ enum ImageInterpolation { ImageInterpolation_Nearest, - ImageInterpolation_Linear + ImageInterpolation_Linear, + ImageInterpolation_Bilinear, + ImageInterpolation_Trilinear }; enum KeyboardModifiers diff -r 2115530d3703 -r 88bca952cb17 Framework/Volumes/ImageBuffer3D.cpp --- a/Framework/Volumes/ImageBuffer3D.cpp Thu Jan 18 14:42:33 2018 +0100 +++ b/Framework/Volumes/ImageBuffer3D.cpp Thu Jan 18 17:23:21 2018 +0100 @@ -422,6 +422,28 @@ } + uint8_t ImageBuffer3D::GetPixelGrayscale8(unsigned int x, + unsigned int y, + unsigned int z) const + { + if (format_ != Orthanc::PixelFormat_Grayscale8) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat); + } + + if (x >= width_ || + y >= height_ || + z >= depth_) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); + } + + const void* p = image_.GetConstRow(y + height_ * (depth_ - 1 - z)); + + return reinterpret_cast(p) [x]; + } + + uint16_t ImageBuffer3D::GetPixelGrayscale16(unsigned int x, unsigned int y, unsigned int z) const @@ -442,5 +464,4 @@ return reinterpret_cast(p) [x]; } - } diff -r 2115530d3703 -r 88bca952cb17 Framework/Volumes/ImageBuffer3D.h --- a/Framework/Volumes/ImageBuffer3D.h Thu Jan 18 14:42:33 2018 +0100 +++ b/Framework/Volumes/ImageBuffer3D.h Thu Jan 18 17:23:21 2018 +0100 @@ -114,6 +114,10 @@ bool FitWindowingToRange(RenderStyle& style, const DicomFrameConverter& converter) const; + uint8_t GetPixelGrayscale8(unsigned int x, + unsigned int y, + unsigned int z) const; + uint16_t GetPixelGrayscale16(unsigned int x, unsigned int y, unsigned int z) const;