diff Framework/Volumes/VolumeImageGeometry.cpp @ 809:e8fdf29cd0ca

VolumeImageGeometry::GetProjectionSlice()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 28 May 2019 18:09:26 +0200
parents fa5febe0f0c2
children ffec76a5f7eb
line wrap: on
line diff
--- a/Framework/Volumes/VolumeImageGeometry.cpp	Tue May 28 17:44:53 2019 +0200
+++ b/Framework/Volumes/VolumeImageGeometry.cpp	Tue May 28 18:09:26 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;
+  }
 }