comparison OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.h @ 1775:fca942f4b4a7

fix conversion from voxel centers to texture borders
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 May 2021 19:57:50 +0200
parents a217140dd41a
children d9c5474c5588
comparison
equal deleted inserted replaced
1774:95ece40bb298 1775:fca942f4b4a7
57 void CopyParameters(const TextureBaseSceneLayer& other); 57 void CopyParameters(const TextureBaseSceneLayer& other);
58 58
59 public: 59 public:
60 TextureBaseSceneLayer(); 60 TextureBaseSceneLayer();
61 61
62 private:
63 /**
64 * TODO - The methods below could be removed, as well as the
65 * corresponding members
66 **/
67
62 // Center of the top-left pixel 68 // Center of the top-left pixel
63 void SetOrigin(double x, 69 void SetOrigin(double x,
64 double y); 70 double y);
65 71
66 void SetPixelSpacing(double sx, 72 void SetPixelSpacing(double sx,
67 double sy); 73 double sy);
68 74
69 // In radians 75 // In radians
70 void SetAngle(double angle); 76 void SetAngle(double angle);
71
72 void SetLinearInterpolation(bool isLinearInterpolation);
73 77
74 void SetFlipX(bool flip); 78 void SetFlipX(bool flip);
75 79
76 void SetFlipY(bool flip); 80 void SetFlipY(bool flip);
77 81
98 double GetAngle() const 102 double GetAngle() const
99 { 103 {
100 return angle_; 104 return angle_;
101 } 105 }
102 106
103 bool IsLinearInterpolation() const
104 {
105 return isLinearInterpolation_;
106 }
107
108 bool HasTexture() const
109 {
110 return (texture_.get() != NULL);
111 }
112
113 bool IsFlipX() const 107 bool IsFlipX() const
114 { 108 {
115 return flipX_; 109 return flipX_;
116 } 110 }
117 111
118 bool IsFlipY() const 112 bool IsFlipY() const
119 { 113 {
120 return flipY_; 114 return flipY_;
121 } 115 }
122 116
117 public:
118 bool IsLinearInterpolation() const
119 {
120 return isLinearInterpolation_;
121 }
122
123 void SetLinearInterpolation(bool isLinearInterpolation);
124
125 bool HasTexture() const
126 {
127 return (texture_.get() != NULL);
128 }
129
123 const Orthanc::ImageAccessor& GetTexture() const; 130 const Orthanc::ImageAccessor& GetTexture() const;
124 131
125 void SetTransform(const AffineTransform2D& transform); 132 void SetTransform(const AffineTransform2D& transform);
126 133
127 void ClearTransform(); 134 void ClearTransform();
128 135
129 // Initialize a transform that maps a texture slice in 3D, to a 136 /**
130 // cutting plane (the cutting plane should be parallel to the 3D 137 * Initialize a transform that maps a texture slice in 3D, to a
131 // slice). The "pixelOffsetX/Y" must take pixel spacing into account. 138 * cutting plane (the cutting plane should be parallel to the 3D
139 * slice). The "pixelOffsetX/Y" must take pixel spacing into
140 * account. This method automatically converts from voxel centers
141 * (3D) to pixel corners (2D).
142 **/
132 void SetCuttingPlaneTransform(const CoordinateSystem3D& cuttingPlane, 143 void SetCuttingPlaneTransform(const CoordinateSystem3D& cuttingPlane,
133 const Vector& origin, // coordinates of the center of the voxel 144 const Vector& origin, // coordinates of the center of the voxel
134 const Vector& pixelOffsetX, // 3D offset from (0,0) voxel to (1,0) voxel 145 const Vector& pixelOffsetX, // 3D offset from (0,0) voxel to (1,0) voxel
135 const Vector& pixelOffsetY); // 3D offset from (0,0) voxel to (0,1) voxel 146 const Vector& pixelOffsetY); // 3D offset from (0,0) voxel to (0,1) voxel
136 147