comparison OrthancStone/Sources/Volumes/DicomVolumeImageMPRSlicer.cpp @ 1769:a217140dd41a

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 May 2021 10:26:13 +0200
parents 226718777702
children f302bbddf94d
comparison
equal deleted inserted replaced
1768:226718777702 1769:a217140dd41a
95 * TextureBaseSceneLayer::GetTransform(). Is it an error? 95 * TextureBaseSceneLayer::GetTransform(). Is it an error?
96 **/ 96 **/
97 97
98 Vector pixelSpacing = volume_.GetGeometry().GetVoxelDimensions(projection_); 98 Vector pixelSpacing = volume_.GetGeometry().GetVoxelDimensions(projection_);
99 99
100 double x0, y0, x1, y1, x2, y2; 100 texture->SetCuttingPlaneTransform(cuttingPlane, system.GetOrigin(),
101 cuttingPlane.ProjectPoint(x0, y0, system.GetOrigin()); 101 system.GetAxisX() * pixelSpacing[0],
102 cuttingPlane.ProjectPoint(x1, y1, system.GetOrigin() + system.GetAxisX() * pixelSpacing[0]); 102 system.GetAxisY() * pixelSpacing[1]);
103 cuttingPlane.ProjectPoint(x2, y2, system.GetOrigin() + system.GetAxisY() * pixelSpacing[1]);
104
105 /**
106
107 A = [ a11 a12 ; a21 a22 ]
108
109 (1) A * (0 ; 0) + (b1 ; b2) = (x0 ; y0)
110 (2) A * (1 ; 0) + (b1 ; b2) = (x1 ; y1)
111 (3) A * (0 ; 1) + (b1 ; b2) = (x2 ; y2)
112
113 (2-1) A * (1 ; 0) = (x1 - x0 ; y1 - y0) <=> (a11 ; a21) = (x1 - x0 ; y1 - y0)
114 (3-1) A * (0 ; 1) = (x2 - x0 ; y2 - y0) <=> (a12 ; a22) = (x2 - x0 ; y2 - y0)
115
116 **/
117
118 Matrix m(3, 3);
119 m(0, 0) = x1 - x0; // a11
120 m(0, 1) = x2 - x0; // a12
121 m(0, 2) = x0; // b1
122 m(1, 0) = y1 - y0; // a21
123 m(1, 1) = y2 - y0; // a22
124 m(1, 2) = y0; // b2
125 m(2, 0) = 0;
126 m(2, 1) = 0;
127 m(2, 2) = 1;
128
129 texture->SetTransform(AffineTransform2D(m));
130 103
131 return texture.release(); 104 return texture.release();
132 } 105 }
133 106
134 107