summaryrefslogtreecommitdiffstats
path: root/src/ConeVecProjectionGeometry3D.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2016-07-28 17:05:24 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2016-07-28 17:05:24 +0200
commitb2611a03577c285ddf48edab0d05dafa09ab362c (patch)
treec1d2f1b5166ba23f55e68e8faf0832f7c540f787 /src/ConeVecProjectionGeometry3D.cpp
parent1ff4a270a7df1edb54dd91fe653d6a936b959b3a (diff)
parent53249b3ad63f0d08b9862a75602acf263d230d77 (diff)
downloadastra-b2611a03577c285ddf48edab0d05dafa09ab362c.tar.gz
astra-b2611a03577c285ddf48edab0d05dafa09ab362c.tar.bz2
astra-b2611a03577c285ddf48edab0d05dafa09ab362c.tar.xz
astra-b2611a03577c285ddf48edab0d05dafa09ab362c.zip
Merge branch 'master' into parvec
Diffstat (limited to 'src/ConeVecProjectionGeometry3D.cpp')
-rw-r--r--src/ConeVecProjectionGeometry3D.cpp88
1 files changed, 71 insertions, 17 deletions
diff --git a/src/ConeVecProjectionGeometry3D.cpp b/src/ConeVecProjectionGeometry3D.cpp
index 47ed630..f4f900d 100644
--- a/src/ConeVecProjectionGeometry3D.cpp
+++ b/src/ConeVecProjectionGeometry3D.cpp
@@ -27,9 +27,9 @@ $Id$
*/
#include "astra/ConeVecProjectionGeometry3D.h"
+#include "astra/Utilities.h"
#include <cstring>
-#include <boost/lexical_cast.hpp>
using namespace std;
@@ -82,13 +82,13 @@ bool CConeVecProjectionGeometry3D::initialize(const Config& _cfg)
// Required: DetectorRowCount
node = _cfg.self.getSingleNode("DetectorRowCount");
ASTRA_CONFIG_CHECK(node, "ConeVecProjectionGeometry3D", "No DetectorRowCount tag specified.");
- m_iDetectorRowCount = boost::lexical_cast<int>(node.getContent());
+ m_iDetectorRowCount = node.getContentInt();
CC.markNodeParsed("DetectorRowCount");
// Required: DetectorColCount
node = _cfg.self.getSingleNode("DetectorColCount");
ASTRA_CONFIG_CHECK(node, "ConeVecProjectionGeometry3D", "No DetectorColCount tag specified.");
- m_iDetectorColCount = boost::lexical_cast<int>(node.getContent());
+ m_iDetectorColCount = node.getContentInt();
m_iDetectorTotCount = m_iDetectorRowCount * m_iDetectorColCount;
CC.markNodeParsed("DetectorColCount");
@@ -212,18 +212,18 @@ Config* CConeVecProjectionGeometry3D::getConfiguration() const
std::string vectors = "";
for (int i = 0; i < m_iProjectionAngleCount; ++i) {
SConeProjection& p = m_pProjectionAngles[i];
- vectors += boost::lexical_cast<string>(p.fSrcX) + ",";
- vectors += boost::lexical_cast<string>(p.fSrcY) + ",";
- vectors += boost::lexical_cast<string>(p.fSrcZ) + ",";
- 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);
+ vectors += StringUtil::toString(p.fSrcX) + ",";
+ vectors += StringUtil::toString(p.fSrcY) + ",";
+ vectors += StringUtil::toString(p.fSrcZ) + ",";
+ vectors += StringUtil::toString(p.fDetSX + 0.5f*m_iDetectorRowCount*p.fDetVX + 0.5f*m_iDetectorColCount*p.fDetUX) + ",";
+ vectors += StringUtil::toString(p.fDetSY + 0.5f*m_iDetectorRowCount*p.fDetVY + 0.5f*m_iDetectorColCount*p.fDetUY) + ",";
+ vectors += StringUtil::toString(p.fDetSZ + 0.5f*m_iDetectorRowCount*p.fDetVZ + 0.5f*m_iDetectorColCount*p.fDetUZ) + ",";
+ vectors += StringUtil::toString(p.fDetUX) + ",";
+ vectors += StringUtil::toString(p.fDetUY) + ",";
+ vectors += StringUtil::toString(p.fDetUZ) + ",";
+ vectors += StringUtil::toString(p.fDetVX) + ",";
+ vectors += StringUtil::toString(p.fDetVY) + ",";
+ vectors += StringUtil::toString(p.fDetVZ);
if (i < m_iProjectionAngleCount-1) vectors += ';';
}
cfg->self.addChildNode("Vectors", vectors);
@@ -241,9 +241,9 @@ CVector3D CConeVecProjectionGeometry3D::getProjectionDirection(int _iProjectionI
return CVector3D(p.fDetSX + (u+0.5)*p.fDetUX + (v+0.5)*p.fDetVX - p.fSrcX, p.fDetSY + (u+0.5)*p.fDetUY + (v+0.5)*p.fDetVY - p.fSrcY, p.fDetSZ + (u+0.5)*p.fDetUZ + (v+0.5)*p.fDetVZ - p.fSrcZ);
}
-void CConeVecProjectionGeometry3D::projectPoint(float32 fX, float32 fY, float32 fZ,
+void CConeVecProjectionGeometry3D::projectPoint(double fX, double fY, double fZ,
int iAngleIndex,
- float32 &fU, float32 &fV) const
+ double &fU, double &fV) const
{
ASTRA_ASSERT(iAngleIndex >= 0);
ASTRA_ASSERT(iAngleIndex < m_iProjectionAngleCount);
@@ -262,6 +262,60 @@ void CConeVecProjectionGeometry3D::projectPoint(float32 fX, float32 fY, float32
}
+void CConeVecProjectionGeometry3D::backprojectPointX(int iAngleIndex, double fU, double fV,
+ double fX, double &fY, double &fZ) const
+{
+ ASTRA_ASSERT(iAngleIndex >= 0);
+ ASTRA_ASSERT(iAngleIndex < m_iProjectionAngleCount);
+
+ SConeProjection &proj = m_pProjectionAngles[iAngleIndex];
+
+ double px = proj.fDetSX + fU * proj.fDetUX + fV * proj.fDetVX;
+ double py = proj.fDetSY + fU * proj.fDetUY + fV * proj.fDetVY;
+ double pz = proj.fDetSZ + fU * proj.fDetUZ + fV * proj.fDetVZ;
+
+ double a = (fX - proj.fSrcX) / (px - proj.fSrcX);
+
+ fY = proj.fSrcY + a * (py - proj.fSrcY);
+ fZ = proj.fSrcZ + a * (pz - proj.fSrcZ);
+}
+
+void CConeVecProjectionGeometry3D::backprojectPointY(int iAngleIndex, double fU, double fV,
+ double fY, double &fX, double &fZ) const
+{
+ ASTRA_ASSERT(iAngleIndex >= 0);
+ ASTRA_ASSERT(iAngleIndex < m_iProjectionAngleCount);
+
+ SConeProjection &proj = m_pProjectionAngles[iAngleIndex];
+
+ double px = proj.fDetSX + fU * proj.fDetUX + fV * proj.fDetVX;
+ double py = proj.fDetSY + fU * proj.fDetUY + fV * proj.fDetVY;
+ double pz = proj.fDetSZ + fU * proj.fDetUZ + fV * proj.fDetVZ;
+
+ double a = (fY - proj.fSrcY) / (py - proj.fSrcY);
+
+ fX = proj.fSrcX + a * (px - proj.fSrcX);
+ fZ = proj.fSrcZ + a * (pz - proj.fSrcZ);
+}
+
+void CConeVecProjectionGeometry3D::backprojectPointZ(int iAngleIndex, double fU, double fV,
+ double fZ, double &fX, double &fY) const
+{
+ ASTRA_ASSERT(iAngleIndex >= 0);
+ ASTRA_ASSERT(iAngleIndex < m_iProjectionAngleCount);
+
+ SConeProjection &proj = m_pProjectionAngles[iAngleIndex];
+
+ double px = proj.fDetSX + fU * proj.fDetUX + fV * proj.fDetVX;
+ double py = proj.fDetSY + fU * proj.fDetUY + fV * proj.fDetVY;
+ double pz = proj.fDetSZ + fU * proj.fDetUZ + fV * proj.fDetVZ;
+
+ double a = (fZ - proj.fSrcZ) / (pz - proj.fSrcZ);
+
+ fX = proj.fSrcX + a * (px - proj.fSrcX);
+ fY = proj.fSrcY + a * (py - proj.fSrcY);
+}
+
//----------------------------------------------------------------------------------------
bool CConeVecProjectionGeometry3D::_check()