diff options
Diffstat (limited to 'src/ParallelVecProjectionGeometry3D.cpp')
-rw-r--r-- | src/ParallelVecProjectionGeometry3D.cpp | 54 |
1 files changed, 48 insertions, 6 deletions
diff --git a/src/ParallelVecProjectionGeometry3D.cpp b/src/ParallelVecProjectionGeometry3D.cpp index c8071a6..dc325e9 100644 --- a/src/ParallelVecProjectionGeometry3D.cpp +++ b/src/ParallelVecProjectionGeometry3D.cpp @@ -202,14 +202,38 @@ bool CParallelVecProjectionGeometry3D::isOfType(const std::string& _sType) const } //---------------------------------------------------------------------------------------- -void CParallelVecProjectionGeometry3D::toXML(XMLNode* _sNode) const +// Get the configuration object +Config* CParallelVecProjectionGeometry3D::getConfiguration() const { - _sNode->addAttribute("type","parallel3d_vec"); - _sNode->addChildNode("DetectorRowCount", m_iDetectorRowCount); - _sNode->addChildNode("DetectorColCount", m_iDetectorColCount); - // TODO: - //_sNode->addChildNode("ProjectionAngles", m_pfProjectionAngles, m_iProjectionAngleCount); + Config* cfg = new Config(); + cfg->initialize("ProjectionGeometry3D"); + + cfg->self->addAttribute("type", "parallel3d_vec"); + cfg->self->addChildNode("DetectorRowCount", m_iDetectorRowCount); + cfg->self->addChildNode("DetectorColCount", m_iDetectorColCount); + + std::string vectors = ""; + for (int i = 0; i < m_iProjectionAngleCount; ++i) { + SPar3DProjection& p = m_pProjectionAngles[i]; + vectors += boost::lexical_cast<string>(p.fRayX) + ","; + vectors += boost::lexical_cast<string>(p.fRayY) + ","; + vectors += boost::lexical_cast<string>(p.fRayZ) + ","; + vectors += boost::lexical_cast<string>(p.fDetSX + 0.5f*m_iDetectorRowCount*p.fDetVX + 0.5f*m_iDetectorColCount*p.fDetUX) + ","; + vectors += boost::lexical_cast<string>(p.fDetSY + 0.5f*m_iDetectorRowCount*p.fDetVY + 0.5f*m_iDetectorColCount*p.fDetUY) + ","; + vectors += boost::lexical_cast<string>(p.fDetSZ + 0.5f*m_iDetectorRowCount*p.fDetVZ + 0.5f*m_iDetectorColCount*p.fDetUZ) + ","; + vectors += boost::lexical_cast<string>(p.fDetUX) + ","; + vectors += boost::lexical_cast<string>(p.fDetUY) + ","; + vectors += boost::lexical_cast<string>(p.fDetUZ) + ","; + vectors += boost::lexical_cast<string>(p.fDetVX) + ","; + vectors += boost::lexical_cast<string>(p.fDetVY) + ","; + vectors += boost::lexical_cast<string>(p.fDetVZ); + if (i < m_iProjectionAngleCount-1) vectors += ';'; + } + cfg->self->addChildNode("Vectors", vectors); + + return cfg; } +//---------------------------------------------------------------------------------------- CVector3D CParallelVecProjectionGeometry3D::getProjectionDirection(int _iProjectionIndex, int _iDetectorIndex) const { @@ -218,6 +242,24 @@ CVector3D CParallelVecProjectionGeometry3D::getProjectionDirection(int _iProject return CVector3D(p.fRayX, p.fRayY, p.fRayZ); } +void CParallelVecProjectionGeometry3D::projectPoint(float32 fX, float32 fY, float32 fZ, + int iAngleIndex, + float32 &fU, float32 &fV) const +{ + 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; + +} //---------------------------------------------------------------------------------------- |