comparison Framework/Volumes/ImageBuffer3D.h @ 143:58c545177c1c wasm

optimization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 22 Jan 2018 15:16:19 +0100
parents 88bca952cb17
children f7be90de6d1b
comparison
equal deleted inserted replaced
142:f19194a11c1d 143:58c545177c1c
54 Orthanc::ImageAccessor GetCoronalSliceAccessor(unsigned int slice, 54 Orthanc::ImageAccessor GetCoronalSliceAccessor(unsigned int slice,
55 bool readOnly); 55 bool readOnly);
56 56
57 Orthanc::Image* ExtractSagittalSlice(unsigned int slice) const; 57 Orthanc::Image* ExtractSagittalSlice(unsigned int slice) const;
58 58
59 template <typename T>
60 T GetPixelUnchecked(unsigned int x,
61 unsigned int y,
62 unsigned int z) const
63 {
64 const uint8_t* buffer = reinterpret_cast<const uint8_t*>(image_.GetConstBuffer());
65 const uint8_t* row = buffer + (y + height_ * (depth_ - 1 - z)) * image_.GetPitch();
66 return reinterpret_cast<const T*>(row) [x];
67 }
68
59 public: 69 public:
60 ImageBuffer3D(Orthanc::PixelFormat format, 70 ImageBuffer3D(Orthanc::PixelFormat format,
61 unsigned int width, 71 unsigned int width,
62 unsigned int height, 72 unsigned int height,
63 unsigned int depth, 73 unsigned int depth,
112 float& maxValue) const; 122 float& maxValue) const;
113 123
114 bool FitWindowingToRange(RenderStyle& style, 124 bool FitWindowingToRange(RenderStyle& style,
115 const DicomFrameConverter& converter) const; 125 const DicomFrameConverter& converter) const;
116 126
117 uint8_t GetPixelGrayscale8(unsigned int x, 127 uint8_t GetVoxelGrayscale8Unchecked(unsigned int x,
128 unsigned int y,
129 unsigned int z) const
130 {
131 return GetPixelUnchecked<uint8_t>(x, y, z);
132 }
133
134 uint16_t GetVoxelGrayscale16Unchecked(unsigned int x,
135 unsigned int y,
136 unsigned int z) const
137 {
138 return GetPixelUnchecked<uint16_t>(x, y, z);
139 }
140
141 uint8_t GetVoxelGrayscale8(unsigned int x,
118 unsigned int y, 142 unsigned int y,
119 unsigned int z) const; 143 unsigned int z) const;
120 144
121 uint16_t GetPixelGrayscale16(unsigned int x, 145 uint16_t GetVoxelGrayscale16(unsigned int x,
122 unsigned int y, 146 unsigned int y,
123 unsigned int z) const; 147 unsigned int z) const;
124 148
125 149
126 class SliceReader : public boost::noncopyable 150 class SliceReader : public boost::noncopyable