summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim van Aarle <wimvanaarle@gmail.com>2015-03-03 18:22:23 +0100
committerWim van Aarle <wimvanaarle@gmail.com>2015-03-03 18:22:23 +0100
commita452bc6f1c450a7174ec257d052dfe3ce25b1623 (patch)
tree95da84f485a0235f4cf049717f953909f6bf3f37
parente468c6c546dbb4d9665ccb95b1571a160753d50e (diff)
downloadastra-a452bc6f1c450a7174ec257d052dfe3ce25b1623.tar.gz
astra-a452bc6f1c450a7174ec257d052dfe3ce25b1623.tar.bz2
astra-a452bc6f1c450a7174ec257d052dfe3ce25b1623.tar.xz
astra-a452bc6f1c450a7174ec257d052dfe3ce25b1623.zip
created parallel_vec geometry class
-rw-r--r--astra_vc11.vcxproj4
-rw-r--r--astra_vc11.vcxproj.filters14
-rw-r--r--include/astra/GeometryUtil2D.h12
-rw-r--r--include/astra/ParallelVecProjectionGeometry2D.h163
-rw-r--r--matlab/mex/astra_mex_data2d_c.cpp5
-rw-r--r--matlab/tools/astra_create_proj_geom.m13
-rw-r--r--matlab/tools/astra_geom_2vec.m26
-rw-r--r--src/ParallelVecProjectionGeometry2D.cpp239
-rw-r--r--src/Projector2D.cpp5
9 files changed, 474 insertions, 7 deletions
diff --git a/astra_vc11.vcxproj b/astra_vc11.vcxproj
index 6596a05..91b216e 100644
--- a/astra_vc11.vcxproj
+++ b/astra_vc11.vcxproj
@@ -263,6 +263,7 @@
<ClCompile Include="src\ParallelBeamStripKernelProjector2D.cpp" />
<ClCompile Include="src\ParallelProjectionGeometry2D.cpp" />
<ClCompile Include="src\ParallelProjectionGeometry3D.cpp" />
+ <ClCompile Include="src\ParallelVecProjectionGeometry2D.cpp" />
<ClCompile Include="src\ParallelVecProjectionGeometry3D.cpp" />
<ClCompile Include="src\PlatformDepSystemCode.cpp" />
<ClCompile Include="src\ProjectionGeometry2D.cpp" />
@@ -375,6 +376,7 @@
<ClInclude Include="include\astra\ParallelProjectionGeometry2D.h" />
<ClInclude Include="include\astra\ParallelProjectionGeometry3D.h" />
<ClInclude Include="include\astra\ParallelVecProjectionGeometry3D.h" />
+ <ClInclude Include="include\astra\ParallelVecProjectionGeometry2D.h" />
<ClInclude Include="include\astra\PlatformDepSystemCode.h" />
<ClInclude Include="include\astra\ProjectionGeometry2D.h" />
<ClInclude Include="include\astra\ProjectionGeometry3D.h" />
@@ -438,4 +440,4 @@
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 5.5.targets" />
</ImportGroup>
-</Project>
+</Project> \ No newline at end of file
diff --git a/astra_vc11.vcxproj.filters b/astra_vc11.vcxproj.filters
index c4ba594..0453ec7 100644
--- a/astra_vc11.vcxproj.filters
+++ b/astra_vc11.vcxproj.filters
@@ -37,9 +37,6 @@
<CudaCompile Include="cuda\3d\darthelper3d.cu">
<Filter>CUDA\cuda source</Filter>
</CudaCompile>
- <CudaCompile Include="cuda\3d\dims3d.cu">
- <Filter>CUDA\cuda source</Filter>
- </CudaCompile>
<CudaCompile Include="cuda\2d\em.cu">
<Filter>CUDA\cuda source</Filter>
</CudaCompile>
@@ -312,6 +309,10 @@
<ClCompile Include="src\CudaSirtAlgorithm3D.cpp">
<Filter>CUDA\astra source</Filter>
</ClCompile>
+ <ClCompile Include="src\GeometryUtil3D.cpp" />
+ <ClCompile Include="src\ParallelVecProjectionGeometry2D.cpp">
+ <Filter>Geometries\source</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\astra\Algorithm.h">
@@ -644,6 +645,11 @@
<ClInclude Include="cuda\3d\util3d.h">
<Filter>CUDA\cuda headers</Filter>
</ClInclude>
+ <ClInclude Include="include\astra\GeometryUtil2D.h" />
+ <ClInclude Include="include\astra\GeometryUtil3D.h" />
+ <ClInclude Include="include\astra\ParallelVecProjectionGeometry2D.h">
+ <Filter>Geometries\headers</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="include\astra\DataProjectorPolicies.inl">
@@ -736,4 +742,4 @@
<UniqueIdentifier>{04a878ed-77b4-4525-9bc2-38ccd65282c5}</UniqueIdentifier>
</Filter>
</ItemGroup>
-</Project>
+</Project> \ No newline at end of file
diff --git a/include/astra/GeometryUtil2D.h b/include/astra/GeometryUtil2D.h
index d4ee92e..680cecd 100644
--- a/include/astra/GeometryUtil2D.h
+++ b/include/astra/GeometryUtil2D.h
@@ -31,6 +31,18 @@ $Id$
namespace astra {
+struct SParProjection {
+ // the ray direction
+ float fRayX, fRayY;
+
+ // the start of the (linear) detector
+ float fDetSX, fDetSY;
+
+ // the length of a single detector pixel
+ float fDetUX, fDetUY;
+};
+
+
struct SFanProjection {
// the source
float fSrcX, fSrcY;
diff --git a/include/astra/ParallelVecProjectionGeometry2D.h b/include/astra/ParallelVecProjectionGeometry2D.h
new file mode 100644
index 0000000..96f8a54
--- /dev/null
+++ b/include/astra/ParallelVecProjectionGeometry2D.h
@@ -0,0 +1,163 @@
+/*
+-----------------------------------------------------------------------
+Copyright: 2010-2015, iMinds-Vision Lab, University of Antwerp
+ 2014-2015, CWI, Amsterdam
+
+Contact: astra@uantwerpen.be
+Website: http://sf.net/projects/astra-toolbox
+
+This file is part of the ASTRA Toolbox.
+
+
+The ASTRA Toolbox is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+The ASTRA Toolbox is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>.
+
+-----------------------------------------------------------------------
+$Id$
+*/
+
+#ifndef _INC_ASTRA_PARALLELVECPROJECTIONGEOMETRY2D
+#define _INC_ASTRA_PARALLELVECPROJECTIONGEOMETRY2D
+
+#include "ProjectionGeometry2D.h"
+#include "GeometryUtil2D.h"
+
+namespace astra
+{
+
+/**
+ * This class defines a 2D parallel beam projection geometry.
+ *
+ * \par XML Configuration
+ * \astra_xml_item{DetectorCount, int, Number of detectors for each projection.}
+ *
+ * \par MATLAB example
+ * \astra_code{
+ * proj_geom = astra_struct('parallel_vec');\n
+ * proj_geom.DetectorCount = 512;\n
+ * proj_geom.Vectors = V;\n
+ * }
+ *
+ * \par Vectors
+ * Vectors is a matrix containing the actual geometry. Each row corresponds
+ * to a single projection, and consists of:
+ * ( rayX, rayY, dX, dY, uX, uY)
+ * ray: the ray direction
+ * d : the centre of the detector line
+ * u : the vector from detector pixel (0) to (1)
+ */
+class _AstraExport CParallelVecProjectionGeometry2D : public CProjectionGeometry2D
+{
+protected:
+
+ SParProjection *m_pProjectionAngles;
+
+public:
+
+ /** Default constructor. Sets all variables to zero. Note that this constructor leaves the object in an unusable state and must
+ * be followed by a call to init().
+ */
+ CParallelVecProjectionGeometry2D();
+
+ /** Constructor.
+ *
+ * @param _iProjectionAngleCount Number of projection angles.
+ * @param _iDetectorCount Number of detectors, i.e., the number of detector measurements for each projection angle.
+ * @param _pfProjectionAngles Pointer to an array of projection angles. The angles will be copied from this array.
+ */
+ CParallelVecProjectionGeometry2D(int _iProjectionAngleCount,
+ int _iDetectorCount,
+ const SParProjection* _pfProjectionAngles);
+
+ /** Copy constructor.
+ */
+ CParallelVecProjectionGeometry2D(const CParallelVecProjectionGeometry2D& _projGeom);
+
+ /** Assignment operator.
+ */
+ CParallelVecProjectionGeometry2D& operator=(const CParallelVecProjectionGeometry2D& _other);
+
+ /** Destructor.
+ */
+ virtual ~CParallelVecProjectionGeometry2D();
+
+ /** Initialize the geometry with a config object.
+ *
+ * @param _cfg Configuration Object
+ * @return initialization successful?
+ */
+ virtual bool initialize(const Config& _cfg);
+
+ /** Initialization. This function MUST be called after using the default constructor and MAY be called to
+ * reset a previously initialized object.
+ *
+ * @param _iProjectionAngleCount Number of projection angles.
+ * @param _iDetectorCount Number of detectors, i.e., the number of detector measurements for each projection angle.
+ * @param _pfProjectionAngles Pointer to an array of projection angles. The angles will be copied from this array.
+ */
+ bool initialize(int _iProjectionAngleCount,
+ int _iDetectorCount,
+ const SParProjection* _pfProjectionAngles);
+
+ virtual bool _check();
+
+ /** Create a hard copy.
+ */
+ virtual CProjectionGeometry2D* clone();
+
+ /** Returns true if the type of geometry defined in this class is the one specified in _sType.
+ *
+ * @param _sType geometry type to compare to.
+ * @return true if _sType == "fanflat_vec".
+ */
+ virtual bool isOfType(const std::string& _sType);
+
+ /** Return true if this geometry instance is the same as the one specified.
+ *
+ * @return true if this geometry instance is the same as the one specified.
+ */
+ virtual bool isEqual(CProjectionGeometry2D*) const;
+
+ /** Get all settings in a Config object.
+ *
+ * @return Configuration Object.
+ */
+ virtual Config* getConfiguration() const;
+
+
+ /** Get the value for t and theta, based upon the row and column index.
+ *
+ * @param _iRow row index
+ * @param _iColumn column index
+ * @param _fT output: value of t
+ * @param _fTheta output: value of theta, always lies within the [0,pi[ interval.
+ */
+ virtual void getRayParams(int _iRow, int _iColumn, float32& _fT, float32& _fTheta) const;
+
+ /**
+ * Returns a vector describing the direction of a ray belonging to a certain detector
+ *
+ * @param _iProjectionIndex index of projection
+ * @param _iProjectionIndex index of detector
+ *
+ * @return a unit vector describing the direction
+ */
+ virtual CVector3D getProjectionDirection(int _iProjectionIndex, int _iDetectorIndex);
+
+ const SParProjection* getProjectionVectors() const { return m_pProjectionAngles; }
+
+};
+
+} // namespace astra
+
+#endif /* _INC_ASTRA_PARALLELVECPROJECTIONGEOMETRY2D */
diff --git a/matlab/mex/astra_mex_data2d_c.cpp b/matlab/mex/astra_mex_data2d_c.cpp
index 5f79e98..62c5d80 100644
--- a/matlab/mex/astra_mex_data2d_c.cpp
+++ b/matlab/mex/astra_mex_data2d_c.cpp
@@ -44,6 +44,7 @@ $Id$
#include "astra/SparseMatrixProjectionGeometry2D.h"
#include "astra/FanFlatProjectionGeometry2D.h"
#include "astra/FanFlatVecProjectionGeometry2D.h"
+#include "astra/ParallelVecProjectionGeometry2D.h"
using namespace std;
using namespace astra;
@@ -159,6 +160,8 @@ void astra_mex_data2d_create(int& nlhs, mxArray* plhs[], int& nrhs, const mxArra
pGeometry = new CFanFlatProjectionGeometry2D();
} else if (type == "fanflat_vec") {
pGeometry = new CFanFlatVecProjectionGeometry2D();
+ } else if (type == "parallel_vec") {
+ pGeometry = new CParallelVecProjectionGeometry2D();
} else {
pGeometry = new CParallelProjectionGeometry2D();
}
@@ -448,6 +451,8 @@ void astra_mex_data2d_change_geometry(int nlhs, mxArray* plhs[], int nrhs, const
pGeometry = new CFanFlatProjectionGeometry2D();
} else if (type == "fanflat_vec") {
pGeometry = new CFanFlatVecProjectionGeometry2D();
+ } else if (type == "parallel_vec") {
+ pGeometry = new CParallelVecProjectionGeometry2D();
} else {
pGeometry = new CParallelProjectionGeometry2D();
}
diff --git a/matlab/tools/astra_create_proj_geom.m b/matlab/tools/astra_create_proj_geom.m
index 862e410..ff7d74d 100644
--- a/matlab/tools/astra_create_proj_geom.m
+++ b/matlab/tools/astra_create_proj_geom.m
@@ -107,6 +107,19 @@ if strcmp(type,'parallel')
'ProjectionAngles', varargin{3} ...
);
+elseif strcmp(type,'parallel_vec')
+ if numel(varargin) < 2
+ error('not enough variables: astra_create_proj_geom(parallel_vec, det_count, V')
+ end
+ if size(varargin{2}, 2) ~= 6
+ error('V should be a Nx6 matrix, with N the number of projections')
+ end
+ proj_geom = struct( ...
+ 'type', 'parallel_vec', ...
+ 'DetectorCount', varargin{1}, ...
+ 'Vectors', varargin{2} ...
+ );
+
elseif strcmp(type,'fanflat')
if numel(varargin) < 5
error('not enough variables: astra_create_proj_geom(fanflat, det_width, det_count, angles, source_origin, source_det)');
diff --git a/matlab/tools/astra_geom_2vec.m b/matlab/tools/astra_geom_2vec.m
index 0abd07c..c6dda0d 100644
--- a/matlab/tools/astra_geom_2vec.m
+++ b/matlab/tools/astra_geom_2vec.m
@@ -1,7 +1,29 @@
function proj_geom_out = astra_geom_2vec(proj_geom)
+ % PARALLEL 2D
+ if strcmp(proj_geom.type,'parallel')
+
+ vectors = zeros(numel(proj_geom.ProjectionAngles), 6);
+ for i = 1:numel(proj_geom.ProjectionAngles)
+
+ % ray direction
+ vectors(i,1) = sin(proj_geom.ProjectionAngles(i));
+ vectors(i,2) = -cos(proj_geom.ProjectionAngles(i));
+
+ % center of detector
+ vectors(i,3) = 0;
+ vectors(i,4) = 0;
+
+ % vector from detector pixel 0 to 1
+ vectors(i,5) = cos(proj_geom.ProjectionAngles(i)) * proj_geom.DetectorWidth;
+ vectors(i,6) = sin(proj_geom.ProjectionAngles(i)) * proj_geom.DetectorWidth;
+
+ end
+
+ proj_geom_out = astra_create_proj_geom('parallel_vec', proj_geom.DetectorCount, vectors);
+
% FANFLAT
- if strcmp(proj_geom.type,'fanflat')
+ elseif strcmp(proj_geom.type,'fanflat')
vectors = zeros(numel(proj_geom.ProjectionAngles), 6);
for i = 1:numel(proj_geom.ProjectionAngles)
@@ -50,7 +72,7 @@ function proj_geom_out = astra_geom_2vec(proj_geom)
proj_geom_out = astra_create_proj_geom('cone_vec', proj_geom.DetectorRowCount, proj_geom.DetectorColCount, vectors);
- % PARALLEL
+ % PARALLEL 3D
elseif strcmp(proj_geom.type,'parallel3d')
vectors = zeros(numel(proj_geom.ProjectionAngles), 12);
diff --git a/src/ParallelVecProjectionGeometry2D.cpp b/src/ParallelVecProjectionGeometry2D.cpp
new file mode 100644
index 0000000..c1ed1c4
--- /dev/null
+++ b/src/ParallelVecProjectionGeometry2D.cpp
@@ -0,0 +1,239 @@
+/*
+-----------------------------------------------------------------------
+Copyright: 2010-2015, iMinds-Vision Lab, University of Antwerp
+ 2014-2015, CWI, Amsterdam
+
+Contact: astra@uantwerpen.be
+Website: http://sf.net/projects/astra-toolbox
+
+This file is part of the ASTRA Toolbox.
+
+
+The ASTRA Toolbox is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+The ASTRA Toolbox is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>.
+
+-----------------------------------------------------------------------
+$Id$
+*/
+
+#include "astra/ParallelVecProjectionGeometry2D.h"
+
+#include <cstring>
+#include <sstream>
+#include <boost/lexical_cast.hpp>
+
+using namespace std;
+
+namespace astra
+{
+
+//----------------------------------------------------------------------------------------
+// Default constructor. Sets all variables to zero.
+CParallelVecProjectionGeometry2D::CParallelVecProjectionGeometry2D()
+{
+ _clear();
+ m_pProjectionAngles = 0;
+}
+
+//----------------------------------------------------------------------------------------
+// Constructor.
+CParallelVecProjectionGeometry2D::CParallelVecProjectionGeometry2D(int _iProjectionAngleCount,
+ int _iDetectorCount,
+ const SParProjection* _pProjectionAngles)
+{
+ this->initialize(_iProjectionAngleCount,
+ _iDetectorCount,
+ _pProjectionAngles);
+}
+
+//----------------------------------------------------------------------------------------
+// Copy Constructor
+CParallelVecProjectionGeometry2D::CParallelVecProjectionGeometry2D(const CParallelVecProjectionGeometry2D& _projGeom)
+{
+ _clear();
+ this->initialize(_projGeom.m_iProjectionAngleCount,
+ _projGeom.m_iDetectorCount,
+ _projGeom.m_pProjectionAngles);
+}
+
+//----------------------------------------------------------------------------------------
+// Destructor.
+CParallelVecProjectionGeometry2D::~CParallelVecProjectionGeometry2D()
+{
+ // TODO
+ delete[] m_pProjectionAngles;
+}
+
+
+//----------------------------------------------------------------------------------------
+// Initialization.
+bool CParallelVecProjectionGeometry2D::initialize(int _iProjectionAngleCount,
+ int _iDetectorCount,
+ const SParProjection* _pProjectionAngles)
+{
+ m_iProjectionAngleCount = _iProjectionAngleCount;
+ m_iDetectorCount = _iDetectorCount;
+ m_pProjectionAngles = new SParProjection[m_iProjectionAngleCount];
+ for (int i = 0; i < m_iProjectionAngleCount; ++i)
+ m_pProjectionAngles[i] = _pProjectionAngles[i];
+
+ // TODO: check?
+
+ // success
+ m_bInitialized = _check();
+ return m_bInitialized;
+}
+
+//----------------------------------------------------------------------------------------
+// Initialization with a Config object
+bool CParallelVecProjectionGeometry2D::initialize(const Config& _cfg)
+{
+ ASTRA_ASSERT(_cfg.self);
+ ConfigStackCheck<CProjectionGeometry2D> CC("ParallelVecProjectionGeometry2D", this, _cfg);
+
+ XMLNode* node;
+
+ // TODO: Fix up class hierarchy... this class doesn't fit very well.
+ // initialization of parent class
+ //CProjectionGeometry2D::initialize(_cfg);
+
+ // Required: DetectorCount
+ node = _cfg.self->getSingleNode("DetectorCount");
+ ASTRA_CONFIG_CHECK(node, "ParallelVecProjectionGeometry2D", "No DetectorRowCount tag specified.");
+ m_iDetectorCount = boost::lexical_cast<int>(node->getContent());
+ ASTRA_DELETE(node);
+ CC.markNodeParsed("DetectorCount");
+
+ // Required: Vectors
+ node = _cfg.self->getSingleNode("Vectors");
+ ASTRA_CONFIG_CHECK(node, "ParallelVecProjectionGeometry2D", "No Vectors tag specified.");
+ vector<float32> data = node->getContentNumericalArray();
+ CC.markNodeParsed("Vectors");
+ ASTRA_DELETE(node);
+ ASTRA_CONFIG_CHECK(data.size() % 6 == 0, "ParallelVecProjectionGeometry2D", "Vectors doesn't consist of 6-tuples.");
+ m_iProjectionAngleCount = data.size() / 6;
+ m_pProjectionAngles = new SParProjection[m_iProjectionAngleCount];
+
+ for (int i = 0; i < m_iProjectionAngleCount; ++i) {
+ SParProjection& p = m_pProjectionAngles[i];
+ p.fRayX = data[6*i + 0];
+ p.fRayY = data[6*i + 1];
+ p.fDetUX = data[6*i + 4];
+ p.fDetUY = data[6*i + 5];
+
+ // The backend code currently expects the corner of the detector, while
+ // the matlab interface supplies the center
+ p.fDetSX = data[6*i + 2] - 0.5f * m_iDetectorCount * p.fDetUX;
+ p.fDetSY = data[6*i + 3] - 0.5f * m_iDetectorCount * p.fDetUY;
+ }
+
+
+
+ // success
+ m_bInitialized = _check();
+ return m_bInitialized;
+}
+
+//----------------------------------------------------------------------------------------
+// Clone
+CProjectionGeometry2D* CParallelVecProjectionGeometry2D::clone()
+{
+ return new CParallelVecProjectionGeometry2D(*this);
+}
+
+//----------------------------------------------------------------------------------------
+// is equal
+bool CParallelVecProjectionGeometry2D::isEqual(CProjectionGeometry2D* _pGeom2) const
+{
+ if (_pGeom2 == NULL) return false;
+
+ // try to cast argument to CParallelVecProjectionGeometry2D
+ CParallelVecProjectionGeometry2D* pGeom2 = dynamic_cast<CParallelVecProjectionGeometry2D*>(_pGeom2);
+ if (pGeom2 == NULL) return false;
+
+ // both objects must be initialized
+ if (!m_bInitialized || !pGeom2->m_bInitialized) return false;
+
+ // check all values
+ if (m_iProjectionAngleCount != pGeom2->m_iProjectionAngleCount) return false;
+ if (m_iDetectorCount != pGeom2->m_iDetectorCount) return false;
+
+ for (int i = 0; i < m_iProjectionAngleCount; ++i) {
+ if (memcmp(&m_pProjectionAngles[i], &pGeom2->m_pProjectionAngles[i], sizeof(m_pProjectionAngles[i])) != 0) return false;
+ }
+
+ return true;
+}
+
+//----------------------------------------------------------------------------------------
+// Is of type
+bool CParallelVecProjectionGeometry2D::isOfType(const std::string& _sType)
+{
+ return (_sType == "parallel_vec");
+}
+
+//----------------------------------------------------------------------------------------
+
+CVector3D CParallelVecProjectionGeometry2D::getProjectionDirection(int _iProjectionIndex, int _iDetectorIndex /* = 0 */)
+{
+ CVector3D vOutput(0.0f, 0.0f, 0.0f);
+
+ // not implemented
+ ASTRA_ASSERT(false);
+
+ return vOutput;
+}
+
+//----------------------------------------------------------------------------------------
+
+void CParallelVecProjectionGeometry2D::getRayParams(int _iRow, int _iColumn, float32& _fT, float32& _fTheta) const
+{
+ // not implemented
+ ASTRA_ASSERT(false);
+}
+
+//----------------------------------------------------------------------------------------
+
+bool CParallelVecProjectionGeometry2D::_check()
+{
+ // TODO
+ return true;
+}
+
+
+//----------------------------------------------------------------------------------------
+// Get the configuration object
+Config* CParallelVecProjectionGeometry2D::getConfiguration() const
+{
+ Config* cfg = new Config();
+ cfg->initialize("ProjectionGeometry2D");
+ cfg->self->addAttribute("type", "parallel_vec");
+ cfg->self->addChildNode("DetectorCount", getDetectorCount());
+ std::string vectors = "";
+ for (int i = 0; i < m_iProjectionAngleCount; ++i) {
+ SParProjection& p = m_pProjectionAngles[i];
+ vectors += boost::lexical_cast<string>(p.fRayX) + ",";
+ vectors += boost::lexical_cast<string>(p.fRayY) + ",";
+ vectors += boost::lexical_cast<string>(p.fDetSX + 0.5f * m_iDetectorCount * p.fDetUX) + ",";
+ vectors += boost::lexical_cast<string>(p.fDetSY + 0.5f * m_iDetectorCount * p.fDetUY) + ",";
+ vectors += boost::lexical_cast<string>(p.fDetUX) + ",";
+ vectors += boost::lexical_cast<string>(p.fDetUY);
+ if (i < m_iProjectionAngleCount-1) vectors += ';';
+ }
+ cfg->self->addChildNode("Vectors", vectors);
+ return cfg;
+}
+//----------------------------------------------------------------------------------------
+
+
+} // namespace astra
diff --git a/src/Projector2D.cpp b/src/Projector2D.cpp
index 32a2956..b0ace92 100644
--- a/src/Projector2D.cpp
+++ b/src/Projector2D.cpp
@@ -28,6 +28,7 @@ $Id$
#include "astra/Projector2D.h"
+#include "astra/ParallelVecProjectionGeometry2D.h"
#include "astra/FanFlatProjectionGeometry2D.h"
#include "astra/FanFlatVecProjectionGeometry2D.h"
#include "astra/SparseMatrixProjectionGeometry2D.h"
@@ -131,6 +132,10 @@ bool CProjector2D::initialize(const Config& _cfg)
CFanFlatVecProjectionGeometry2D* pFanFlatVecProjectionGeometry = new CFanFlatVecProjectionGeometry2D();
pFanFlatVecProjectionGeometry->initialize(Config(node));
m_pProjectionGeometry = pFanFlatVecProjectionGeometry;
+ } else if (type == "parallel_vec") {
+ CParallelVecProjectionGeometry2D* pParallelVecProjectionGeometry = new CParallelVecProjectionGeometry2D();
+ pParallelVecProjectionGeometry->initialize(Config(node));
+ m_pProjectionGeometry = pParallelVecProjectionGeometry;
} else {
m_pProjectionGeometry = new CParallelProjectionGeometry2D();
m_pProjectionGeometry->initialize(Config(node));