diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2014-12-03 11:44:20 +0100 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2014-12-03 16:13:38 +0100 |
commit | 899faabba87628698fbc02a06f4a91ba6469fd8d (patch) | |
tree | 25c784cc6f2720d9e00530c239a632e8483a9e9f /src | |
parent | b3e8338a7fa4c7ed9a5954ca02fa3126aefff530 (diff) | |
download | astra-899faabba87628698fbc02a06f4a91ba6469fd8d.tar.gz astra-899faabba87628698fbc02a06f4a91ba6469fd8d.tar.bz2 astra-899faabba87628698fbc02a06f4a91ba6469fd8d.tar.xz astra-899faabba87628698fbc02a06f4a91ba6469fd8d.zip |
Move BP coordinate transformation to utility function
Diffstat (limited to 'src')
-rw-r--r-- | src/ConeVecProjectionGeometry3D.cpp | 17 | ||||
-rw-r--r-- | src/ParallelVecProjectionGeometry3D.cpp | 16 |
2 files changed, 27 insertions, 6 deletions
diff --git a/src/ConeVecProjectionGeometry3D.cpp b/src/ConeVecProjectionGeometry3D.cpp index 29d84b7..79f56c4 100644 --- a/src/ConeVecProjectionGeometry3D.cpp +++ b/src/ConeVecProjectionGeometry3D.cpp @@ -224,9 +224,20 @@ void CConeVecProjectionGeometry3D::projectPoint(float32 fX, float32 fY, float32 int iAngleIndex, float32 &fU, float32 &fV) const { -#warning implementme - fU = 0.0f/0.0f; - fV = 0.0f/0.0f; + ASTRA_ASSERT(iAngleIndex >= 0); + ASTRA_ASSERT(iAngleIndex < m_iProjectionAngleCount); + + double fUX, fUY, fUZ, fUC; + double fVX, fVY, fVZ, fVC; + double fDX, fDY, fDZ, fDC; + + computeBP_UV_Coeffs(m_pProjectionAngles[iAngleIndex], + fUX, fUY, fUZ, fUC, fVX, fVY, fVZ, fVC, fDX, fDY, fDZ, fDC); + + // The -0.5f shifts from corner to center of detector pixels + double fD = fDX*fX + fDY*fY + fDZ*fZ + fDC; + fU = (fUX*fX + fUY*fY + fUZ*fZ + fUC) / fD - 0.5f; + fV = (fVX*fX + fVY*fY + fVZ*fZ + fVC) / fD - 0.5f; } diff --git a/src/ParallelVecProjectionGeometry3D.cpp b/src/ParallelVecProjectionGeometry3D.cpp index 7c2d2cd..56597fc 100644 --- a/src/ParallelVecProjectionGeometry3D.cpp +++ b/src/ParallelVecProjectionGeometry3D.cpp @@ -222,9 +222,19 @@ void CParallelVecProjectionGeometry3D::projectPoint(float32 fX, float32 fY, floa int iAngleIndex, float32 &fU, float32 &fV) const { -#warning implementme - fU = 0.0f/0.0f; - fV = 0.0f/0.0f; + ASTRA_ASSERT(iAngleIndex >= 0); + ASTRA_ASSERT(iAngleIndex < m_iProjectionAngleCount); + + double fUX, fUY, fUZ, fUC; + double fVX, fVY, fVZ, fVC; + + computeBP_UV_Coeffs(m_pProjectionAngles[iAngleIndex], + fUX, fUY, fUZ, fUC, fVX, fVY, fVZ, fVC); + + // The -0.5f shifts from corner to center of detector pixels + fU = (fUX*fX + fUY*fY + fUZ*fZ + fUC) - 0.5f; + fV = (fVX*fX + fVY*fY + fVZ*fZ + fVC) - 0.5f; + } //---------------------------------------------------------------------------------------- |