changeset 810:7608e8107aa1

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 28 May 2019 18:09:48 +0200
parents e8fdf29cd0ca (diff) 269522196741 (current diff)
children ffec76a5f7eb
files Framework/Toolbox/ISeriesLoader.h
diffstat 3 files changed, 29 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Volumes/VolumeImageGeometry.cpp	Tue May 28 17:50:09 2019 +0200
+++ b/Framework/Volumes/VolumeImageGeometry.cpp	Tue May 28 18:09:48 2019 +0200
@@ -306,4 +306,21 @@
       return true;
     }
   }
+
+
+  CoordinateSystem3D VolumeImageGeometry::GetProjectionSlice(VolumeProjection projection,
+                                                             unsigned int depth) const
+  {
+    if (depth >= GetProjectionDepth(projection))
+    {
+      throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
+    }
+
+    Vector dim = GetVoxelDimensions(projection);
+    CoordinateSystem3D plane = GetProjectionGeometry(projection);
+
+    plane.SetOrigin(plane.GetOrigin() + static_cast<double>(depth) * plane.GetNormal() * dim[2]);
+
+    return plane;
+  }
 }
--- a/Framework/Volumes/VolumeImageGeometry.h	Tue May 28 17:50:09 2019 +0200
+++ b/Framework/Volumes/VolumeImageGeometry.h	Tue May 28 18:09:48 2019 +0200
@@ -127,5 +127,8 @@
     bool DetectSlice(VolumeProjection& projection,
                      unsigned int& slice,
                      const CoordinateSystem3D& plane) const;
+
+    CoordinateSystem3D GetProjectionSlice(VolumeProjection projection,
+                                          unsigned int depth) const;
   };
 }
--- a/UnitTestsSources/UnitTestsMain.cpp	Tue May 28 17:50:09 2019 +0200
+++ b/UnitTestsSources/UnitTestsMain.cpp	Tue May 28 18:09:48 2019 +0200
@@ -699,18 +699,22 @@
     OrthancStone::VolumeProjection projection = (OrthancStone::VolumeProjection) p;
     const OrthancStone::CoordinateSystem3D& s = g.GetProjectionGeometry(projection);
     
+    ASSERT_THROW(g.GetProjectionSlice(projection, g.GetProjectionDepth(projection)), Orthanc::OrthancException);
+
     for (unsigned int i = 0; i < g.GetProjectionDepth(projection); i++)
     {
-      OrthancStone::CoordinateSystem3D plane(
-        s.GetOrigin() + static_cast<double>(i) * s.GetNormal() * g.GetVoxelDimensions(projection)[2],
-        s.GetAxisX(),
-        s.GetAxisY());
+      OrthancStone::CoordinateSystem3D plane = g.GetProjectionSlice(projection, i);
+
+      ASSERT_TRUE(IsEqualVector(plane.GetOrigin(), s.GetOrigin() + static_cast<double>(i) * 
+                                s.GetNormal() * g.GetVoxelDimensions(projection)[2]));
+      ASSERT_TRUE(IsEqualVector(plane.GetAxisX(), s.GetAxisX()));
+      ASSERT_TRUE(IsEqualVector(plane.GetAxisY(), s.GetAxisY()));
 
       unsigned int slice;
       OrthancStone::VolumeProjection q;
       ASSERT_TRUE(g.DetectSlice(q, slice, plane));
       ASSERT_EQ(projection, q);
-      ASSERT_EQ(i, slice);
+      ASSERT_EQ(i, slice);     
     }
   }
 }