comparison OrthancStone/Sources/Volumes/VolumeImageGeometry.cpp @ 1766:ae18b5cfbd3e

VolumeImageGeometry::DetectProjection() reports if normal is opposite
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 May 2021 11:31:34 +0200
parents 9ac2a65d4172
children e7b4479dea6f
comparison
equal deleted inserted replaced
1765:177f93c8371c 1766:ae18b5cfbd3e
227 return LinearAlgebra::CreateVector(p[0], p[1], p[2]); 227 return LinearAlgebra::CreateVector(p[0], p[1], p[2]);
228 } 228 }
229 229
230 230
231 bool VolumeImageGeometry::DetectProjection(VolumeProjection& projection, 231 bool VolumeImageGeometry::DetectProjection(VolumeProjection& projection,
232 bool& isOpposite,
232 const Vector& planeNormal) const 233 const Vector& planeNormal) const
233 { 234 {
234 if (GeometryToolbox::IsParallel(planeNormal, axialGeometry_.GetNormal())) 235 if (GeometryToolbox::IsParallelOrOpposite(isOpposite, planeNormal, axialGeometry_.GetNormal()))
235 { 236 {
236 projection = VolumeProjection_Axial; 237 projection = VolumeProjection_Axial;
237 return true; 238 return true;
238 } 239 }
239 else if (GeometryToolbox::IsParallel(planeNormal, coronalGeometry_.GetNormal())) 240 else if (GeometryToolbox::IsParallelOrOpposite(isOpposite, planeNormal, coronalGeometry_.GetNormal()))
240 { 241 {
241 projection = VolumeProjection_Coronal; 242 projection = VolumeProjection_Coronal;
242 return true; 243 return true;
243 } 244 }
244 else if (GeometryToolbox::IsParallel(planeNormal, sagittalGeometry_.GetNormal())) 245 else if (GeometryToolbox::IsParallelOrOpposite(isOpposite, planeNormal, sagittalGeometry_.GetNormal()))
245 { 246 {
246 projection = VolumeProjection_Sagittal; 247 projection = VolumeProjection_Sagittal;
247 return true; 248 return true;
248 } 249 }
249 else 250 else
255 256
256 bool VolumeImageGeometry::DetectSlice(VolumeProjection& projection, 257 bool VolumeImageGeometry::DetectSlice(VolumeProjection& projection,
257 unsigned int& slice, 258 unsigned int& slice,
258 const CoordinateSystem3D& plane) const 259 const CoordinateSystem3D& plane) const
259 { 260 {
260 if (!DetectProjection(projection, plane.GetNormal())) 261 bool isOpposite;
262 if (!DetectProjection(projection, isOpposite, plane.GetNormal()))
261 { 263 {
262 return false; 264 return false;
263 } 265 }
264 266
265 // Transforms the coordinates of the origin of the plane, into the 267 // Transforms the coordinates of the origin of the plane, into the