summaryrefslogtreecommitdiffstats
path: root/src/ParallelProjectionGeometry2D.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ParallelProjectionGeometry2D.cpp')
-rw-r--r--src/ParallelProjectionGeometry2D.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/ParallelProjectionGeometry2D.cpp b/src/ParallelProjectionGeometry2D.cpp
index 699e141..8632b17 100644
--- a/src/ParallelProjectionGeometry2D.cpp
+++ b/src/ParallelProjectionGeometry2D.cpp
@@ -67,8 +67,7 @@ CParallelProjectionGeometry2D::CParallelProjectionGeometry2D(const CParallelProj
initialize(_projGeom.m_iProjectionAngleCount,
_projGeom.m_iDetectorCount,
_projGeom.m_fDetectorWidth,
- _projGeom.m_pfProjectionAngles,
- _projGeom.m_pfExtraDetectorOffset);
+ _projGeom.m_pfProjectionAngles);
}
//----------------------------------------------------------------------------------------
@@ -182,8 +181,8 @@ Config* CParallelProjectionGeometry2D::getConfiguration() const
cfg->self.addChildNode("ProjectionAngles", m_pfProjectionAngles, m_iProjectionAngleCount);
return cfg;
}
-//----------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------
CVector3D CParallelProjectionGeometry2D::getProjectionDirection(int _iProjectionIndex, int _iDetectorIndex /* = 0 */)
{
CVector3D vOutput;
@@ -197,4 +196,24 @@ CVector3D CParallelProjectionGeometry2D::getProjectionDirection(int _iProjection
return vOutput;
}
+//----------------------------------------------------------------------------------------
+CParallelVecProjectionGeometry2D* CParallelProjectionGeometry2D::toVectorGeometry()
+{
+ SParProjection* vectors = new SParProjection[m_iProjectionAngleCount];
+ for (int i = 0; i < m_iProjectionAngleCount; ++i)
+ {
+ vectors[i].fRayX = sinf(m_pfProjectionAngles[i]);
+ vectors[i].fRayY = -cosf(m_pfProjectionAngles[i]);
+ vectors[i].fDetUX = cosf(m_pfProjectionAngles[i]) * m_fDetectorWidth;
+ vectors[i].fDetUY = sinf(m_pfProjectionAngles[i]) * m_fDetectorWidth;
+ vectors[i].fDetSX = -0.5f * m_iDetectorCount * vectors[i].fDetUX;
+ vectors[i].fDetSY = -0.5f * m_iDetectorCount * vectors[i].fDetUY;
+ }
+
+ CParallelVecProjectionGeometry2D* vecGeom = new CParallelVecProjectionGeometry2D();
+ vecGeom->initialize(m_iProjectionAngleCount, m_iDetectorCount, vectors);
+ delete[] vectors;
+ return vecGeom;
+}
+
} // end namespace astra