# HG changeset patch # User Sebastien Jodogne # Date 1516121056 -3600 # Node ID 22628d37ef5cfa0625b7351a4f79e54b3e2afcce # Parent 77c4fef7f4a58faca29b9faa0172f121b38bdbf1 ImageBuffer3D::GetPixelGrayscale16 diff -r 77c4fef7f4a5 -r 22628d37ef5c Framework/Volumes/ImageBuffer3D.cpp --- a/Framework/Volumes/ImageBuffer3D.cpp Tue Jan 16 13:47:54 2018 +0100 +++ b/Framework/Volumes/ImageBuffer3D.cpp Tue Jan 16 17:44:16 2018 +0100 @@ -158,7 +158,7 @@ } - Vector ImageBuffer3D::GetVoxelDimensions(VolumeProjection projection) + Vector ImageBuffer3D::GetVoxelDimensions(VolumeProjection projection) const { Vector result; switch (projection) @@ -210,7 +210,7 @@ } - ParallelSlices* ImageBuffer3D::GetGeometry(VolumeProjection projection) + ParallelSlices* ImageBuffer3D::GetGeometry(VolumeProjection projection) const { std::auto_ptr result(new ParallelSlices); @@ -420,4 +420,27 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); } } + + + uint16_t ImageBuffer3D::GetPixelGrayscale16(unsigned int x, + unsigned int y, + unsigned int z) const + { + if (format_ != Orthanc::PixelFormat_Grayscale16) + { + 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]; + } + } diff -r 77c4fef7f4a5 -r 22628d37ef5c Framework/Volumes/ImageBuffer3D.h --- a/Framework/Volumes/ImageBuffer3D.h Tue Jan 16 13:47:54 2018 +0100 +++ b/Framework/Volumes/ImageBuffer3D.h Tue Jan 16 17:44:16 2018 +0100 @@ -69,11 +69,16 @@ // depth == 0) void SetAxialGeometry(const CoordinateSystem3D& geometry); + const CoordinateSystem3D& GetAxialGeometry() const + { + return axialGeometry_; + } + void SetVoxelDimensions(double x, double y, double z); - Vector GetVoxelDimensions(VolumeProjection projection); + Vector GetVoxelDimensions(VolumeProjection projection) const; void GetSliceSize(unsigned int& width, unsigned int& height, @@ -99,7 +104,7 @@ return format_; } - ParallelSlices* GetGeometry(VolumeProjection projection); + ParallelSlices* GetGeometry(VolumeProjection projection) const; uint64_t GetEstimatedMemorySize() const; @@ -109,6 +114,10 @@ bool FitWindowingToRange(RenderStyle& style, const DicomFrameConverter& converter) const; + uint16_t GetPixelGrayscale16(unsigned int x, + unsigned int y, + unsigned int z) const; + class SliceReader : public boost::noncopyable {