summaryrefslogtreecommitdiffstats
path: root/src/ConeProjectionGeometry3D.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <wjp@usecode.org>2015-12-04 16:04:58 +0100
committerWillem Jan Palenstijn <wjp@usecode.org>2015-12-04 16:04:58 +0100
commitb6891106eb167e7399a88efe858abccb8b3dd0c0 (patch)
treea92a3f08ec3a4ed7751ec5ae563f217bd8614731 /src/ConeProjectionGeometry3D.cpp
parent7ba1ff9ff08daf043cc131434373cde38434f46b (diff)
parente07449189a05e3bcdc8ad4a9fbb95c0751f567bb (diff)
downloadastra-b6891106eb167e7399a88efe858abccb8b3dd0c0.tar.gz
astra-b6891106eb167e7399a88efe858abccb8b3dd0c0.tar.bz2
astra-b6891106eb167e7399a88efe858abccb8b3dd0c0.tar.xz
astra-b6891106eb167e7399a88efe858abccb8b3dd0c0.zip
Merge pull request #101 from wjp/composite
Add CompositeGeometryManager
Diffstat (limited to 'src/ConeProjectionGeometry3D.cpp')
-rw-r--r--src/ConeProjectionGeometry3D.cpp92
1 files changed, 86 insertions, 6 deletions
diff --git a/src/ConeProjectionGeometry3D.cpp b/src/ConeProjectionGeometry3D.cpp
index dd22eba..18f0f8a 100644
--- a/src/ConeProjectionGeometry3D.cpp
+++ b/src/ConeProjectionGeometry3D.cpp
@@ -29,6 +29,7 @@ $Id$
#include "astra/ConeProjectionGeometry3D.h"
#include "astra/Logging.h"
+#include "astra/GeometryUtil3D.h"
#include <boost/lexical_cast.hpp>
#include <cstring>
@@ -230,14 +231,14 @@ CVector3D CConeProjectionGeometry3D::getProjectionDirection(int _iProjectionInde
return ret;
}
-void CConeProjectionGeometry3D::projectPoint(float32 fX, float32 fY, float32 fZ,
- int iAngleIndex,
- float32 &fU, float32 &fV) const
+void CConeProjectionGeometry3D::projectPoint(double fX, double fY, double fZ,
+ int iAngleIndex,
+ double &fU, double &fV) const
{
ASTRA_ASSERT(iAngleIndex >= 0);
ASTRA_ASSERT(iAngleIndex < m_iProjectionAngleCount);
- float alpha = m_pfProjectionAngles[iAngleIndex];
+ double alpha = m_pfProjectionAngles[iAngleIndex];
// Project point onto optical axis
@@ -245,14 +246,14 @@ void CConeProjectionGeometry3D::projectPoint(float32 fX, float32 fY, float32 fZ,
// 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;
+ double 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;
+ double fS = cos(alpha) * fX + sin(alpha) * fY;
// Scale fS to detector plane
fU = detectorOffsetXToColIndexFloat( (fS * (m_fOriginSourceDistance + m_fOriginDetectorDistance)) / fD );
@@ -261,5 +262,84 @@ void CConeProjectionGeometry3D::projectPoint(float32 fX, float32 fY, float32 fZ,
}
+void CConeProjectionGeometry3D::backprojectPointX(int iAngleIndex, double fU, double fV,
+ double fX, double &fY, double &fZ) const
+{
+ ASTRA_ASSERT(iAngleIndex >= 0);
+ ASTRA_ASSERT(iAngleIndex < m_iProjectionAngleCount);
+
+ SConeProjection *projs = genConeProjections(1, m_iDetectorColCount, m_iDetectorRowCount,
+ m_fOriginSourceDistance,
+ m_fOriginDetectorDistance,
+ m_fDetectorSpacingX, m_fDetectorSpacingY,
+ &m_pfProjectionAngles[iAngleIndex]);
+
+ SConeProjection &proj = projs[0];
+
+ 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);
+
+ delete[] projs;
+}
+
+void CConeProjectionGeometry3D::backprojectPointY(int iAngleIndex, double fU, double fV,
+ double fY, double &fX, double &fZ) const
+{
+ ASTRA_ASSERT(iAngleIndex >= 0);
+ ASTRA_ASSERT(iAngleIndex < m_iProjectionAngleCount);
+
+ SConeProjection *projs = genConeProjections(1, m_iDetectorColCount, m_iDetectorRowCount,
+ m_fOriginSourceDistance,
+ m_fOriginDetectorDistance,
+ m_fDetectorSpacingX, m_fDetectorSpacingY,
+ &m_pfProjectionAngles[iAngleIndex]);
+
+ SConeProjection &proj = projs[0];
+
+ 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);
+
+ delete[] projs;
+}
+
+void CConeProjectionGeometry3D::backprojectPointZ(int iAngleIndex, double fU, double fV,
+ double fZ, double &fX, double &fY) const
+{
+ ASTRA_ASSERT(iAngleIndex >= 0);
+ ASTRA_ASSERT(iAngleIndex < m_iProjectionAngleCount);
+
+ SConeProjection *projs = genConeProjections(1, m_iDetectorColCount, m_iDetectorRowCount,
+ m_fOriginSourceDistance,
+ m_fOriginDetectorDistance,
+ m_fDetectorSpacingX, m_fDetectorSpacingY,
+ &m_pfProjectionAngles[iAngleIndex]);
+
+ SConeProjection &proj = projs[0];
+
+ 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);
+
+ delete[] projs;
+}
+
+
} // end namespace astra