diff 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
line wrap: on
line diff
--- a/OrthancStone/Sources/Volumes/VolumeImageGeometry.cpp	Tue May 11 11:01:22 2021 +0200
+++ b/OrthancStone/Sources/Volumes/VolumeImageGeometry.cpp	Tue May 11 11:31:34 2021 +0200
@@ -229,19 +229,20 @@
 
 
   bool VolumeImageGeometry::DetectProjection(VolumeProjection& projection,
+                                             bool& isOpposite,
                                              const Vector& planeNormal) const
   {
-    if (GeometryToolbox::IsParallel(planeNormal, axialGeometry_.GetNormal()))
+    if (GeometryToolbox::IsParallelOrOpposite(isOpposite, planeNormal, axialGeometry_.GetNormal()))
     {
       projection = VolumeProjection_Axial;
       return true;
     }
-    else if (GeometryToolbox::IsParallel(planeNormal, coronalGeometry_.GetNormal()))
+    else if (GeometryToolbox::IsParallelOrOpposite(isOpposite, planeNormal, coronalGeometry_.GetNormal()))
     {
       projection = VolumeProjection_Coronal;
       return true;
     }
-    else if (GeometryToolbox::IsParallel(planeNormal, sagittalGeometry_.GetNormal()))
+    else if (GeometryToolbox::IsParallelOrOpposite(isOpposite, planeNormal, sagittalGeometry_.GetNormal()))
     {
       projection = VolumeProjection_Sagittal;
       return true;
@@ -257,7 +258,8 @@
                                         unsigned int& slice,
                                         const CoordinateSystem3D& plane) const
   {
-    if (!DetectProjection(projection, plane.GetNormal()))
+    bool isOpposite;
+    if (!DetectProjection(projection, isOpposite, plane.GetNormal()))
     {
       return false;
     }