summaryrefslogtreecommitdiffstats
path: root/src/FanFlatProjectionGeometry2D.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/FanFlatProjectionGeometry2D.cpp')
-rw-r--r--src/FanFlatProjectionGeometry2D.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/FanFlatProjectionGeometry2D.cpp b/src/FanFlatProjectionGeometry2D.cpp
index 32a19bc..91b9578 100644
--- a/src/FanFlatProjectionGeometry2D.cpp
+++ b/src/FanFlatProjectionGeometry2D.cpp
@@ -215,7 +215,25 @@ Config* CFanFlatProjectionGeometry2D::getConfiguration() const
cfg->self.addChildNode("ProjectionAngles", m_pfProjectionAngles, m_iProjectionAngleCount);
return cfg;
}
+
//----------------------------------------------------------------------------------------
+CFanFlatVecProjectionGeometry2D* CFanFlatProjectionGeometry2D::toVectorGeometry()
+{
+ SFanProjection* vectors = new SFanProjection[m_iProjectionAngleCount];
+ for (int i = 0; i < m_iProjectionAngleCount; ++i)
+ {
+ vectors[i].fSrcX = sinf(m_pfProjectionAngles[i]) * m_fOriginSourceDistance;
+ vectors[i].fSrcY = -cosf(m_pfProjectionAngles[i]) * m_fOriginSourceDistance;
+ vectors[i].fDetUX = cosf(m_pfProjectionAngles[i]) * m_fDetectorWidth;
+ vectors[i].fDetUY = sinf(m_pfProjectionAngles[i]) * m_fDetectorWidth;
+ vectors[i].fDetSX = -sinf(m_pfProjectionAngles[i]) * m_fOriginDetectorDistance - 0.5f * m_iDetectorCount * vectors[i].fDetUX;
+ vectors[i].fDetSY = cosf(m_pfProjectionAngles[i]) * m_fOriginDetectorDistance - 0.5f * m_iDetectorCount * vectors[i].fDetUY;
+ }
+ CFanFlatVecProjectionGeometry2D* vecGeom = new CFanFlatVecProjectionGeometry2D();
+ vecGeom->initialize(m_iProjectionAngleCount, m_iDetectorCount, vectors);
+ delete[] vectors;
+ return vecGeom;
+}
} // namespace astra