From b3e8338a7fa4c7ed9a5954ca02fa3126aefff530 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 2 Dec 2014 14:20:46 +0100 Subject: Add ProjectionGeometry3D::projectPoint for par3d and cone. Par3d_vec and cone_vec to follow. --- src/ParallelProjectionGeometry3D.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/ParallelProjectionGeometry3D.cpp') diff --git a/src/ParallelProjectionGeometry3D.cpp b/src/ParallelProjectionGeometry3D.cpp index 2027f95..b5cdfb6 100644 --- a/src/ParallelProjectionGeometry3D.cpp +++ b/src/ParallelProjectionGeometry3D.cpp @@ -179,6 +179,22 @@ CVector3D CParallelProjectionGeometry3D::getProjectionDirection(int _iProjection return CVector3D(fDirX, fDirY, fDirZ); } +void CParallelProjectionGeometry3D::projectPoint(float32 fX, float32 fY, float32 fZ, + int iAngleIndex, + float32 &fU, float32 &fV) const +{ + ASTRA_ASSERT(iAngleIndex >= 0); + ASTRA_ASSERT(iAngleIndex < m_iProjectionAngleCount); + + // V (detector row) + fV = detectorOffsetYToRowIndexFloat(fZ); + + // U (detector column) + float alpha = m_pfProjectionAngles[iAngleIndex]; + // projector direction is (cos(alpha), sin(alpha)) + fU = detectorOffsetXToColIndexFloat(cos(alpha) * fX + sin(alpha) * fY); +} + CParallelProjectionGeometry2D * CParallelProjectionGeometry3D::createProjectionGeometry2D() const { const float32 * pfProjectionAngles = getProjectionAngles(); //new float32[getProjectionCount()]; -- cgit v1.2.3