changeset 141:88bca952cb17 wasm

ImageBuffer3D::GetPixelGrayscale8
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 18 Jan 2018 17:23:21 +0100
parents 2115530d3703
children f19194a11c1d
files Framework/Enumerations.h Framework/Volumes/ImageBuffer3D.cpp Framework/Volumes/ImageBuffer3D.h
diffstat 3 files changed, 29 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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<const uint8_t*>(p) [x];
+  }
+
+
   uint16_t ImageBuffer3D::GetPixelGrayscale16(unsigned int x,
                                               unsigned int y,
                                               unsigned int z) const
@@ -442,5 +464,4 @@
 
     return reinterpret_cast<const uint16_t*>(p) [x];
   }
-
 }
--- 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;