comparison Framework/Volumes/ImageBuffer3D.h @ 684:7719eb852dd5

new class: VolumeImageGeometry
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 16 May 2019 16:47:46 +0200
parents dbc1d8bfc68a
children d2c0e347ddc2
comparison
equal deleted inserted replaced
683:dbc1d8bfc68a 684:7719eb852dd5
21 21
22 #pragma once 22 #pragma once
23 23
24 #include "../StoneEnumerations.h" 24 #include "../StoneEnumerations.h"
25 #include "../Layers/RenderStyle.h" 25 #include "../Layers/RenderStyle.h"
26 #include "../Toolbox/CoordinateSystem3D.h" 26 #include "../Toolbox/VolumeImageGeometry.h"
27 #include "../Toolbox/DicomFrameConverter.h" 27 #include "../Toolbox/DicomFrameConverter.h"
28 #include "../Toolbox/ParallelSlices.h" 28 #include "../Toolbox/ParallelSlices.h"
29 29
30 #include <Core/Images/Image.h> 30 #include <Core/Images/Image.h>
31 31
32 namespace OrthancStone 32 namespace OrthancStone
33 { 33 {
34 class ImageBuffer3D : public boost::noncopyable 34 class ImageBuffer3D : public boost::noncopyable
35 { 35 {
36 private: 36 private:
37 CoordinateSystem3D axialGeometry_; 37 VolumeImageGeometry geometry_; // TODO => Move this out of this class
38 CoordinateSystem3D coronalGeometry_;
39 CoordinateSystem3D sagittalGeometry_;
40 Vector voxelDimensions_;
41 Orthanc::Image image_; 38 Orthanc::Image image_;
42 Orthanc::PixelFormat format_; 39 Orthanc::PixelFormat format_;
43 unsigned int width_; 40 unsigned int width_;
44 unsigned int height_; 41 unsigned int height_;
45 unsigned int depth_; 42 unsigned int depth_;
48 float minValue_; 45 float minValue_;
49 float maxValue_; 46 float maxValue_;
50 Matrix transform_; 47 Matrix transform_;
51 Matrix transformInverse_; 48 Matrix transformInverse_;
52 49
53 void UpdateGeometry();
54
55 void ExtendImageRange(const Orthanc::ImageAccessor& slice); 50 void ExtendImageRange(const Orthanc::ImageAccessor& slice);
56 51
57 void GetAxialSliceAccessor(Orthanc::ImageAccessor& target, 52 void GetAxialSliceAccessor(Orthanc::ImageAccessor& target,
58 unsigned int slice, 53 unsigned int slice,
59 bool readOnly) const; 54 bool readOnly) const;
81 unsigned int depth, 76 unsigned int depth,
82 bool computeRange); 77 bool computeRange);
83 78
84 void Clear(); 79 void Clear();
85 80
86 // Set the geometry of the first axial slice (i.e. the one whose 81 VolumeImageGeometry& GetGeometry()
87 // depth == 0) 82 {
88 void SetAxialGeometry(const CoordinateSystem3D& geometry); 83 return geometry_;
89 84 }
90 const CoordinateSystem3D& GetAxialGeometry() const 85
91 { 86 const VolumeImageGeometry& GetGeometry() const
92 return axialGeometry_; 87 {
93 } 88 return geometry_;
94 89 }
95 const CoordinateSystem3D& GetCoronalGeometry() const
96 {
97 return coronalGeometry_;
98 }
99
100 const CoordinateSystem3D& GetSagittalGeometry() const
101 {
102 return sagittalGeometry_;
103 }
104
105 void SetVoxelDimensions(double x,
106 double y,
107 double z);
108
109 Vector GetVoxelDimensions(VolumeProjection projection) const;
110
111 void GetSliceSize(unsigned int& width,
112 unsigned int& height,
113 VolumeProjection projection);
114 90
115 const Orthanc::ImageAccessor& GetInternalImage() const 91 const Orthanc::ImageAccessor& GetInternalImage() const
116 { 92 {
117 return image_; 93 return image_;
118 } 94 }
175 151
176 uint16_t GetVoxelGrayscale16(unsigned int x, 152 uint16_t GetVoxelGrayscale16(unsigned int x,
177 unsigned int y, 153 unsigned int y,
178 unsigned int z) const; 154 unsigned int z) const;
179 155
180 // Get the 3D position of a point in the volume, where x, y and z 156
181 // lie in the [0;1] range
182 Vector GetCoordinates(float x,
183 float y,
184 float z) const;
185
186 bool DetectProjection(VolumeProjection& projection,
187 const CoordinateSystem3D& plane) const;
188
189
190 class SliceReader : public boost::noncopyable 157 class SliceReader : public boost::noncopyable
191 { 158 {
192 private: 159 private:
193 Orthanc::ImageAccessor accessor_; 160 Orthanc::ImageAccessor accessor_;
194 std::auto_ptr<Orthanc::Image> sagittal_; // Unused for axial and coronal 161 std::auto_ptr<Orthanc::Image> sagittal_; // Unused for axial and coronal