Mercurial > hg > orthanc-stone
diff OrthancStone/Sources/Toolbox/SubvoxelReader.h @ 1783:75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 14 May 2021 18:30:24 +0200 |
parents | 9ac2a65d4172 |
children | 3889ae96d2e9 |
line wrap: on
line diff
--- a/OrthancStone/Sources/Toolbox/SubvoxelReader.h Fri May 14 16:30:54 2021 +0200 +++ b/OrthancStone/Sources/Toolbox/SubvoxelReader.h Fri May 14 18:30:24 2021 +0200 @@ -34,13 +34,6 @@ { namespace Internals { - /* - WARNING : the slice order is different between this class and ImageBuffer3D - - See the comment above ImageBuffer3D declaration. - - The slices are supposed to be stored in INCREASING z-order in this class! - */ class SubvoxelReaderBase : public boost::noncopyable { private: @@ -86,31 +79,32 @@ unsigned int ComputeRow(unsigned int y, unsigned int z) const { - return z * height_ + y; + /** + * The "(depth_ - 1 - z)" comes from the fact that + * "ImageBuffer3D" class stores its slices in DECREASING + * z-order along the normal. This computation makes the + * "SubvoxelReader" class use the same convention as + * "ImageBuffer3D::GetVoxelXXX()". + * + * WARNING: Until changeset 1782:f053c80ea411, "z" was + * directly used, causing this class to have a slice order + * that was reversed between "SubvoxelReader" and + * "ImageBuffer3D". This notably made + * "DicomVolumeImageMPRSlicer" and "DicomVolumeImageReslicer" + * inconsistent in sagittal and coronal views (the texture was + * flipped along the Y-axis in the canvas). + **/ + return (depth_ - 1 - z) * height_ + y; } }; } - /* - WARNING : the slice order is different between this class and ImageBuffer3D - - See the comment above ImageBuffer3D declaration. - - The slices are supposed to be stored in INCREASING z-order in this class! - */ template <Orthanc::PixelFormat Format, ImageInterpolation Interpolation> class SubvoxelReader; - /* - WARNING : the slice order is different between this class and ImageBuffer3D - - See the comment above ImageBuffer3D declaration. - - The slices are supposed to be stored in INCREASING z-order in this class! - */ template <Orthanc::PixelFormat Format> class SubvoxelReader<Format, ImageInterpolation_Nearest> : public Internals::SubvoxelReaderBase @@ -136,13 +130,6 @@ }; - /* - WARNING : the slice order is different between this class and ImageBuffer3D - - See the comment above ImageBuffer3D declaration. - - The slices are supposed to be stored in INCREASING z-order in this class! - */ template <Orthanc::PixelFormat Format> class SubvoxelReader<Format, ImageInterpolation_Bilinear> : public Internals::SubvoxelReaderBase @@ -176,13 +163,6 @@ }; - /* - WARNING : the slice order is different between this class and ImageBuffer3D - - See the comment above ImageBuffer3D declaration. - - The slices are supposed to be stored in INCREASING z-order in this class! - */ template <Orthanc::PixelFormat Format> class SubvoxelReader<Format, ImageInterpolation_Trilinear> : public Internals::SubvoxelReaderBase @@ -212,10 +192,6 @@ }; - /* - See important comment above - */ - template <Orthanc::PixelFormat Format> bool SubvoxelReader<Format, ImageInterpolation_Nearest>::GetValue(PixelType& target, float x, @@ -269,10 +245,6 @@ } - /* - See important comment above - */ - template <Orthanc::PixelFormat Format> bool SubvoxelReader<Format, ImageInterpolation_Bilinear>::Sample(float& f00, float& f01, @@ -326,10 +298,6 @@ } - /* - See important comment above - */ - template <Orthanc::PixelFormat Format> bool SubvoxelReader<Format, ImageInterpolation_Bilinear>::GetFloatValue(float& target, float x, @@ -368,10 +336,6 @@ } - /* - See important comment above - */ - template <Orthanc::PixelFormat Format> bool SubvoxelReader<Format, ImageInterpolation_Bilinear>::GetValue(PixelType& target, float x, @@ -392,7 +356,6 @@ } - template <Orthanc::PixelFormat Format> bool SubvoxelReader<Format, ImageInterpolation_Trilinear>::GetFloatValue(float& target, float x, @@ -445,11 +408,6 @@ } - /* - See important comment above - */ - - template <Orthanc::PixelFormat Format> bool SubvoxelReader<Format, ImageInterpolation_Trilinear>::GetValue(PixelType& target, float x,