diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2014-12-02 14:20:46 +0100 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2014-12-02 14:22:02 +0100 |
commit | b3e8338a7fa4c7ed9a5954ca02fa3126aefff530 (patch) | |
tree | e68d4cfeb680ad2d491cc92a3efe5f9a4c9210c2 /src/ConeProjectionGeometry3D.cpp | |
parent | bdc9cc8c8c06b1bf25d24ae242cad708fc0f9b14 (diff) | |
download | astra-b3e8338a7fa4c7ed9a5954ca02fa3126aefff530.tar.gz astra-b3e8338a7fa4c7ed9a5954ca02fa3126aefff530.tar.bz2 astra-b3e8338a7fa4c7ed9a5954ca02fa3126aefff530.tar.xz astra-b3e8338a7fa4c7ed9a5954ca02fa3126aefff530.zip |
Add ProjectionGeometry3D::projectPoint for par3d and cone.
Par3d_vec and cone_vec to follow.
Diffstat (limited to 'src/ConeProjectionGeometry3D.cpp')
-rw-r--r-- | src/ConeProjectionGeometry3D.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/ConeProjectionGeometry3D.cpp b/src/ConeProjectionGeometry3D.cpp index 129e675..4cdb9e4 100644 --- a/src/ConeProjectionGeometry3D.cpp +++ b/src/ConeProjectionGeometry3D.cpp @@ -225,4 +225,36 @@ CVector3D CConeProjectionGeometry3D::getProjectionDirection(int _iProjectionInde return ret; } +void CConeProjectionGeometry3D::projectPoint(float32 fX, float32 fY, float32 fZ, + int iAngleIndex, + float32 &fU, float32 &fV) const +{ + ASTRA_ASSERT(iAngleIndex >= 0); + ASTRA_ASSERT(iAngleIndex < m_iProjectionAngleCount); + + float alpha = m_pfProjectionAngles[iAngleIndex]; + + // Project point onto optical axis + + // Projector direction is (cos(alpha), sin(alpha)) + // Vector source->origin is (-sin(alpha), cos(alpha)) + + // Distance from source, projected on optical axis + float fD = -sin(alpha) * fX + cos(alpha) * fY + m_fOriginSourceDistance; + + // Scale fZ to detector plane + fV = detectorOffsetYToRowIndexFloat( (fZ * (m_fOriginSourceDistance + m_fOriginDetectorDistance)) / fD ); + + + // Orthogonal distance in XY-plane to optical axis + float fS = cos(alpha) * fX + sin(alpha) * fY; + + // Scale fS to detector plane + fU = detectorOffsetXToColIndexFloat( (fS * (m_fOriginSourceDistance + m_fOriginDetectorDistance)) / fD ); + + fprintf(stderr, "alpha: %f, D: %f, V: %f, S: %f, U: %f\n", alpha, fD, fV, fS, fU); + +} + + } // end namespace astra |