summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <WillemJan.Palenstijn@uantwerpen.be>2013-07-01 22:34:11 +0000
committerwpalenst <WillemJan.Palenstijn@uantwerpen.be>2013-07-01 22:34:11 +0000
commitb2fc6c70434674d74551c3a6c01ffb3233499312 (patch)
treeb17f080ebc504ab85ebb7c3d89f917fd87ce9e00 /tests
downloadastra-b2fc6c70434674d74551c3a6c01ffb3233499312.tar.gz
astra-b2fc6c70434674d74551c3a6c01ffb3233499312.tar.bz2
astra-b2fc6c70434674d74551c3a6c01ffb3233499312.tar.xz
astra-b2fc6c70434674d74551c3a6c01ffb3233499312.zip
Update version to 1.3
Diffstat (limited to 'tests')
-rw-r--r--tests/main.cpp38
-rw-r--r--tests/test_AstraObjectManager.cpp79
-rw-r--r--tests/test_FanFlatProjectionGeometry2D.cpp119
-rw-r--r--tests/test_Float32Data2D.cpp229
-rw-r--r--tests/test_Float32ProjectionData2D.cpp115
-rw-r--r--tests/test_Float32VolumeData2D.cpp110
-rw-r--r--tests/test_Fourier.cpp182
-rw-r--r--tests/test_ParallelBeamLineKernelProjector2D.cpp82
-rw-r--r--tests/test_ParallelBeamLinearKernelProjector2D.cpp172
-rw-r--r--tests/test_ParallelProjectionGeometry2D.cpp120
-rw-r--r--tests/test_VolumeGeometry2D.cpp150
-rw-r--r--tests/test_XMLDocument.cpp158
-rw-r--r--tests/tests_vc08.vcproj699
13 files changed, 2253 insertions, 0 deletions
diff --git a/tests/main.cpp b/tests/main.cpp
new file mode 100644
index 0000000..6fc963e
--- /dev/null
+++ b/tests/main.cpp
@@ -0,0 +1,38 @@
+/*
+-----------------------------------------------------------------------
+Copyright 2012 iMinds-Vision Lab, University of Antwerp
+
+Contact: astra@ua.ac.be
+Website: http://astra.ua.ac.be
+
+
+This file is part of the
+All Scale Tomographic Reconstruction Antwerp Toolbox ("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$
+*/
+
+
+
+#define BOOST_TEST_DYN_LINK
+
+// Generate main()
+#define BOOST_AUTO_TEST_MAIN
+
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/test/floating_point_comparison.hpp>
diff --git a/tests/test_AstraObjectManager.cpp b/tests/test_AstraObjectManager.cpp
new file mode 100644
index 0000000..893efb9
--- /dev/null
+++ b/tests/test_AstraObjectManager.cpp
@@ -0,0 +1,79 @@
+/*
+-----------------------------------------------------------------------
+Copyright 2012 iMinds-Vision Lab, University of Antwerp
+
+Contact: astra@ua.ac.be
+Website: http://astra.ua.ac.be
+
+
+This file is part of the
+All Scale Tomographic Reconstruction Antwerp Toolbox ("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$
+*/
+
+
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+
+#include "astra/AstraObjectManager.h"
+
+namespace astra {
+DEFINE_SINGLETON(CAstraObjectManager<int>);
+}
+
+BOOST_AUTO_TEST_CASE( testAstraObjectManager )
+{
+ astra::CAstraObjectManager<int> man;
+
+ int i1 = man.store(new int(1));
+ BOOST_REQUIRE(man.hasIndex(i1));
+ BOOST_CHECK(*(man.get(i1)) == 1);
+
+ int i2 = man.store(new int(2));
+ BOOST_REQUIRE(man.hasIndex(i2));
+ BOOST_CHECK(*(man.get(i1)) == 1);
+ BOOST_CHECK(*(man.get(i2)) == 2);
+
+ man.remove(i1);
+
+ BOOST_CHECK(!man.hasIndex(i1));
+ BOOST_REQUIRE(man.hasIndex(i2));
+
+ int i3 = man.store(new int(3));
+ BOOST_REQUIRE(man.hasIndex(i3));
+ BOOST_CHECK(*(man.get(i2)) == 2);
+ BOOST_CHECK(*(man.get(i3)) == 3);
+
+ int* pi4 = new int(4);
+ int i4 = man.store(pi4);
+ BOOST_REQUIRE(man.hasIndex(i4));
+ BOOST_CHECK(*(man.get(i2)) == 2);
+ BOOST_CHECK(*(man.get(i3)) == 3);
+ BOOST_CHECK(*(man.get(i4)) == 4);
+
+ BOOST_CHECK(man.getIndex(pi4) == i4);
+
+ man.clear();
+
+ BOOST_CHECK(!man.hasIndex(i1));
+ BOOST_CHECK(!man.hasIndex(i2));
+ BOOST_CHECK(!man.hasIndex(i3));
+ BOOST_CHECK(!man.hasIndex(i4));
+ BOOST_CHECK(!man.getIndex(pi4));
+}
diff --git a/tests/test_FanFlatProjectionGeometry2D.cpp b/tests/test_FanFlatProjectionGeometry2D.cpp
new file mode 100644
index 0000000..a07fbf8
--- /dev/null
+++ b/tests/test_FanFlatProjectionGeometry2D.cpp
@@ -0,0 +1,119 @@
+/*
+-----------------------------------------------------------------------
+Copyright 2012 iMinds-Vision Lab, University of Antwerp
+
+Contact: astra@ua.ac.be
+Website: http://astra.ua.ac.be
+
+
+This file is part of the
+All Scale Tomographic Reconstruction Antwerp Toolbox ("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$
+*/
+
+
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/test/test_case_template.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+
+#include <cmath>
+
+#include "astra/FanFlatProjectionGeometry2D.h"
+
+BOOST_AUTO_TEST_CASE( testFanFlatProjectionGeometry2D_Constructor )
+{
+ astra::float32 angles[] = { 0.0f, 1.0f, 2.0f, 3.0f };
+ astra::CFanFlatProjectionGeometry2D geom(4, 8, 0.5f, angles, 1.0f, 2.0f);
+
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ BOOST_CHECK( geom.getProjectionAngleCount() == 4 );
+ BOOST_CHECK( geom.getDetectorCount() == 8 );
+ BOOST_CHECK( geom.getDetectorWidth() == 0.5f );
+ BOOST_CHECK( geom.getProjectionAngle(0) == 0.0f );
+ BOOST_CHECK( geom.getProjectionAngle(1) == 1.0f );
+ BOOST_CHECK( geom.getProjectionAngle(2) == 2.0f );
+ BOOST_CHECK( geom.getProjectionAngle(3) == 3.0f );
+ BOOST_CHECK( geom.getProjectionAngles()[0] == 0.0f );
+ BOOST_CHECK( geom.getProjectionAngles()[3] == 3.0f );
+ BOOST_CHECK( geom.getOriginSourceDistance() == 1.0f );
+ BOOST_CHECK( geom.getOriginDetectorDistance() == 2.0f );
+}
+
+BOOST_AUTO_TEST_CASE( testFanFlatProjectionGeometry2D_Offsets )
+{
+ astra::float32 angles[] = { 0.0f, 1.0f, 2.0f, 3.0f };
+ astra::CFanFlatProjectionGeometry2D geom(4, 8, 0.5f, angles, 1.0f, 2.0f);
+
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ BOOST_CHECK( geom.getSourceDetectorDistance() == 3.0f );
+ BOOST_CHECK_SMALL( geom.getProjectionAngleDegrees(2) - 114.591559026165f, 1e-5f );
+
+ // CHECKME: where is the center of the detector array?
+ BOOST_CHECK( geom.detectorOffsetToIndexFloat(0.0f) == 3.5f );
+ BOOST_CHECK( geom.detectorOffsetToIndexFloat(0.625f) == 4.75f );
+ BOOST_CHECK( geom.detectorOffsetToIndex(-0.1f) == 3 );
+
+ BOOST_CHECK( geom.indexToDetectorOffset(0) == -1.75f );
+ BOOST_CHECK( geom.indexToDetectorOffset(1) == -1.25f );
+
+ int angle, detector;
+ geom.indexToAngleDetectorIndex(10, angle, detector);
+ BOOST_CHECK( angle == 1 );
+ BOOST_CHECK( detector == 2 );
+
+ float t, theta;
+ geom.getRayParams(0, 2, t, theta);
+ BOOST_CHECK_SMALL( tan(theta) + 0.25f, astra::eps );
+ BOOST_CHECK_SMALL( 17.0f*t*t - 1.0f, astra::eps );
+
+ // TODO: add test with large angle
+}
+
+
+BOOST_AUTO_TEST_CASE( testFanFlatProjectionGeometry2D_Clone )
+{
+ astra::float32 angles[] = { 0.0f, 1.0f, 2.0f, 3.0f };
+ astra::CFanFlatProjectionGeometry2D geom(4, 8, 0.5f, angles, 1.0f, 2.0f);
+
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ astra::CFanFlatProjectionGeometry2D* geom2;
+ geom2 = dynamic_cast<astra::CFanFlatProjectionGeometry2D*>(geom.clone());
+
+ BOOST_REQUIRE( geom2 );
+ BOOST_REQUIRE( geom2->isInitialized() );
+
+ BOOST_CHECK( geom.isEqual(geom2) );
+ BOOST_CHECK( geom2->getProjectionAngleCount() == 4 );
+ BOOST_CHECK( geom2->getDetectorCount() == 8 );
+ BOOST_CHECK( geom2->getDetectorWidth() == 0.5f );
+ BOOST_CHECK( geom2->getProjectionAngle(0) == 0.0f );
+ BOOST_CHECK( geom2->getProjectionAngle(1) == 1.0f );
+ BOOST_CHECK( geom2->getProjectionAngle(2) == 2.0f );
+ BOOST_CHECK( geom2->getProjectionAngle(3) == 3.0f );
+ BOOST_CHECK( geom2->getProjectionAngles()[0] == 0.0f );
+ BOOST_CHECK( geom2->getProjectionAngles()[3] == 3.0f );
+ BOOST_CHECK( geom2->getOriginSourceDistance() == 1.0f );
+ BOOST_CHECK( geom2->getOriginDetectorDistance() == 2.0f );
+ delete geom2;
+}
+
diff --git a/tests/test_Float32Data2D.cpp b/tests/test_Float32Data2D.cpp
new file mode 100644
index 0000000..54d642b
--- /dev/null
+++ b/tests/test_Float32Data2D.cpp
@@ -0,0 +1,229 @@
+/*
+-----------------------------------------------------------------------
+Copyright 2012 iMinds-Vision Lab, University of Antwerp
+
+Contact: astra@ua.ac.be
+Website: http://astra.ua.ac.be
+
+
+This file is part of the
+All Scale Tomographic Reconstruction Antwerp Toolbox ("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$
+*/
+
+
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/test/test_case_template.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+
+#include "astra/Float32Data2D.h"
+
+
+// Utility class to test Float32Data2D
+class CTestFloat32Data2D : public astra::CFloat32Data2D {
+public:
+ CTestFloat32Data2D(int _iWidth, int _iHeight)
+ {
+ m_bInitialized = _initialize(_iWidth, _iHeight);
+ }
+ CTestFloat32Data2D(int _iWidth, int _iHeight, const astra::float32* _pfData)
+ {
+ m_bInitialized = _initialize(_iWidth, _iHeight, _pfData);
+ }
+
+ CTestFloat32Data2D(int _iWidth, int _iHeight, astra::float32 _fScalar)
+ {
+ m_bInitialized = _initialize(_iWidth, _iHeight, _fScalar);
+ }
+
+ CTestFloat32Data2D() { }
+
+};
+
+
+struct TestFloat32Data2D {
+ static astra::float32 d[];
+ TestFloat32Data2D() : data(2,2,d)
+ {
+ }
+
+ ~TestFloat32Data2D()
+ {
+ }
+
+ CTestFloat32Data2D data;
+};
+
+astra::float32 TestFloat32Data2D::d[] = { 1.0f, 2.0f, 3.0f, 4.0f };
+
+BOOST_AUTO_TEST_CASE( testFloat32Data2D_Constructor1 )
+{
+ CTestFloat32Data2D data(2,2);
+
+ BOOST_REQUIRE( data.isInitialized() );
+
+ BOOST_CHECK( data.getWidth() == 2 );
+ BOOST_CHECK( data.getHeight() == 2 );
+ BOOST_CHECK( data.getSize() == 4 );
+ BOOST_CHECK( data.getDimensionCount() == 2 );
+
+ BOOST_REQUIRE( data.getDataConst() != 0 );
+ BOOST_REQUIRE( data.getData() != 0 );
+ BOOST_REQUIRE( data.getData2D() != 0 );
+ BOOST_REQUIRE( data.getData2DConst() != 0 );
+ BOOST_REQUIRE( data.getData2D()[0] != 0 );
+ BOOST_REQUIRE( data.getData2DConst()[0] != 0 );
+
+ data.setData(1.0f);
+
+ // CHECKME: should this be necessary?
+ data.updateStatistics();
+
+ BOOST_CHECK( data.getGlobalMin() == 1.0f );
+ BOOST_CHECK( data.getGlobalMax() == 1.0f );
+ BOOST_CHECK( data.getGlobalMean() == 1.0f );
+
+ BOOST_CHECK( data.getData()[0] == 1.0f );
+ BOOST_CHECK( data.getDataConst()[0] == 1.0f );
+ BOOST_CHECK( data.getData2D()[0][0] == 1.0f );
+ BOOST_CHECK( data.getData2DConst()[0][0] == 1.0f );
+}
+
+BOOST_AUTO_TEST_CASE( testFloat32Data2D_Constructor2 )
+{
+ CTestFloat32Data2D data(2,2,1.5f);
+
+ // CHECKME: should this be necessary?
+ data.updateStatistics();
+
+ BOOST_REQUIRE( data.isInitialized() );
+
+ BOOST_CHECK( data.getWidth() == 2 );
+ BOOST_CHECK( data.getHeight() == 2 );
+ BOOST_CHECK( data.getSize() == 4 );
+ BOOST_CHECK( data.getDimensionCount() == 2 );
+
+ BOOST_REQUIRE( data.getDataConst() != 0 );
+ BOOST_REQUIRE( data.getData() != 0 );
+ BOOST_REQUIRE( data.getData2D() != 0 );
+ BOOST_REQUIRE( data.getData2DConst() != 0 );
+ BOOST_REQUIRE( data.getData2D()[0] != 0 );
+ BOOST_REQUIRE( data.getData2DConst()[0] != 0 );
+
+ BOOST_CHECK( data.getGlobalMin() == 1.5f );
+ BOOST_CHECK( data.getGlobalMax() == 1.5f );
+ BOOST_CHECK( data.getGlobalMean() == 1.5f );
+
+ BOOST_CHECK( data.getData()[0] == 1.5f );
+ BOOST_CHECK( data.getDataConst()[0] == 1.5f );
+ BOOST_CHECK( data.getData2D()[0][0] == 1.5f );
+ BOOST_CHECK( data.getData2DConst()[0][0] == 1.5f );
+}
+
+BOOST_AUTO_TEST_CASE( testFloat32Data2D_Constructor3 )
+{
+ astra::float32 d[] = { 1.0f, 2.0f, 3.0f, 4.0f };
+ CTestFloat32Data2D data(2,2,d);
+
+ // CHECKME: should this be necessary?
+ data.updateStatistics();
+
+ BOOST_REQUIRE( data.isInitialized() );
+
+ BOOST_CHECK( data.getWidth() == 2 );
+ BOOST_CHECK( data.getHeight() == 2 );
+ BOOST_CHECK( data.getSize() == 4 );
+ BOOST_CHECK( data.getDimensionCount() == 2 );
+
+ BOOST_REQUIRE( data.getDataConst() != 0 );
+ BOOST_REQUIRE( data.getData() != 0 );
+ BOOST_REQUIRE( data.getData2D() != 0 );
+ BOOST_REQUIRE( data.getData2DConst() != 0 );
+ BOOST_REQUIRE( data.getData2D()[0] != 0 );
+ BOOST_REQUIRE( data.getData2DConst()[0] != 0 );
+
+ BOOST_CHECK( data.getGlobalMin() == 1.0f );
+ BOOST_CHECK( data.getGlobalMax() == 4.0f );
+
+ BOOST_CHECK( data.getData()[0] == 1.0f );
+ BOOST_CHECK( data.getDataConst()[0] == 1.0f );
+ BOOST_CHECK( data.getData2D()[0][0] == 1.0f );
+ BOOST_CHECK( data.getData2DConst()[0][0] == 1.0f );
+
+}
+
+BOOST_FIXTURE_TEST_CASE( testFloat32Data2D_Operators, TestFloat32Data2D )
+{
+ // Note: all operations below involve exactly representable floats,
+ // so there is no need to use epsilons in the checks
+
+ data.updateStatistics();
+
+ // FIXME: should those be correct here?
+ BOOST_CHECK( data.getGlobalMin() == 1.0f );
+ BOOST_CHECK( data.getGlobalMax() == 4.0f );
+ BOOST_CHECK( data.getGlobalMean() == 2.5f );
+
+ data *= 2.0f;
+
+ BOOST_CHECK( data.getDataConst()[0] == 2.0f );
+ BOOST_CHECK( data.getDataConst()[3] == 8.0f );
+
+ data /= 0.5f;
+
+ BOOST_CHECK( data.getDataConst()[0] == 4.0f );
+ BOOST_CHECK( data.getDataConst()[3] == 16.0f );
+
+ astra::float32 d[] = { 1.0f, 2.0f, 3.0f, 4.0f };
+ CTestFloat32Data2D data2(2,2,d);
+
+ data += data2;
+
+ BOOST_CHECK( data.getDataConst()[0] == 5.0f );
+ BOOST_CHECK( data.getDataConst()[3] == 20.0f );
+
+ data *= data2;
+
+ BOOST_CHECK( data.getDataConst()[0] == 5.0f );
+ BOOST_CHECK( data.getDataConst()[3] == 80.0f );
+
+ data -= data2;
+ BOOST_CHECK( data.getDataConst()[0] == 4.0f );
+ BOOST_CHECK( data.getDataConst()[3] == 76.0f );
+
+ data += 0.5f;
+ BOOST_CHECK( data.getDataConst()[0] == 4.5f );
+ BOOST_CHECK( data.getDataConst()[3] == 76.5f );
+
+ data -= 0.5f;
+ BOOST_CHECK( data.getDataConst()[0] == 4.0f );
+ BOOST_CHECK( data.getDataConst()[3] == 76.0f );
+}
+
+BOOST_FIXTURE_TEST_CASE( testFloat32Data2D_Update, TestFloat32Data2D )
+{
+ data.getData()[2] = 42.0f;
+ data.getData()[1] = -37.0f;
+ data.updateStatistics();
+
+ BOOST_CHECK( data.getGlobalMin() == -37.0f );
+ BOOST_CHECK( data.getGlobalMax() == 42.0f );
+ BOOST_CHECK( data.getGlobalMean() == 2.5f );
+}
diff --git a/tests/test_Float32ProjectionData2D.cpp b/tests/test_Float32ProjectionData2D.cpp
new file mode 100644
index 0000000..1fddeec
--- /dev/null
+++ b/tests/test_Float32ProjectionData2D.cpp
@@ -0,0 +1,115 @@
+/*
+-----------------------------------------------------------------------
+Copyright 2012 iMinds-Vision Lab, University of Antwerp
+
+Contact: astra@ua.ac.be
+Website: http://astra.ua.ac.be
+
+
+This file is part of the
+All Scale Tomographic Reconstruction Antwerp Toolbox ("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$
+*/
+
+
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/test/test_case_template.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+
+#include "astra/Float32ProjectionData2D.h"
+#include "astra/ParallelProjectionGeometry2D.h"
+
+// Note: most of the features of CFloat32ProjectionData2D are tested by
+// the CFloat32Data2D tests.
+
+BOOST_AUTO_TEST_CASE( testFloat32ProjectionData2D_Constructor1 )
+{
+ astra::float32 angles[] = { 0.0f, 1.0f };
+ astra::CParallelProjectionGeometry2D geom(2, 4, 0.5f, angles);
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ astra::CFloat32ProjectionData2D data(&geom);
+ BOOST_REQUIRE( data.isInitialized() );
+
+ BOOST_CHECK( data.getType() == astra::CFloat32Data2D::PROJECTION );
+ BOOST_CHECK( data.getGeometry()->isEqual(&geom) );
+}
+
+BOOST_AUTO_TEST_CASE( testFloat32ProjectionData2D_Constructor2 )
+{
+ astra::float32 angles[] = { 0.0f, 1.0f };
+ astra::float32 d[] = { 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.f };
+ astra::CParallelProjectionGeometry2D geom(2, 4, 0.5f, angles);
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ astra::CFloat32ProjectionData2D data(&geom, d);
+ BOOST_REQUIRE( data.isInitialized() );
+
+ BOOST_CHECK( data.getType() == astra::CFloat32Data2D::PROJECTION );
+ BOOST_CHECK( data.getGeometry()->isEqual(&geom) );
+
+ // CHECKME: should this be necessary?
+ data.updateStatistics();
+
+ BOOST_CHECK( data.getGlobalMax() == 10.0f );
+}
+
+BOOST_AUTO_TEST_CASE( testFloat32ProjectionData2D_Constructor3 )
+{
+ astra::float32 angles[] = { 0.0f, 1.0f };
+ astra::CParallelProjectionGeometry2D geom(2, 4, 0.5f, angles);
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ astra::CFloat32ProjectionData2D data(&geom, 3.5f);
+ BOOST_REQUIRE( data.isInitialized() );
+
+ BOOST_CHECK( data.getType() == astra::CFloat32Data2D::PROJECTION );
+ BOOST_CHECK( data.getGeometry()->isEqual(&geom) );
+
+ // CHECKME: should this be necessary?
+ data.updateStatistics();
+
+ BOOST_CHECK( data.getGlobalMax() == 3.5f );
+}
+
+BOOST_AUTO_TEST_CASE( testFloat32ProjectionData2D_Clone )
+{
+ astra::float32 angles[] = { 0.0f, 1.0f };
+ astra::CParallelProjectionGeometry2D geom(2, 4, 0.5f, angles);
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ astra::CFloat32ProjectionData2D data(&geom, 3.5f);
+ BOOST_REQUIRE( data.isInitialized() );
+
+ astra::CFloat32ProjectionData2D data2(data);
+ BOOST_REQUIRE( data2.isInitialized() );
+
+ BOOST_CHECK( data2.getGeometry()->isEqual(&geom) );
+ BOOST_CHECK( data2.getDataConst()[0] == 3.5f );
+ BOOST_CHECK( data2.getDataConst()[3] == 3.5f );
+
+ astra::CFloat32ProjectionData2D data3;
+ data3 = data;
+ BOOST_REQUIRE( data3.isInitialized() );
+
+ BOOST_CHECK( data3.getGeometry()->isEqual(&geom) );
+ BOOST_CHECK( data3.getDataConst()[0] == 3.5f );
+ BOOST_CHECK( data3.getDataConst()[3] == 3.5f );
+}
diff --git a/tests/test_Float32VolumeData2D.cpp b/tests/test_Float32VolumeData2D.cpp
new file mode 100644
index 0000000..29dde3a
--- /dev/null
+++ b/tests/test_Float32VolumeData2D.cpp
@@ -0,0 +1,110 @@
+/*
+-----------------------------------------------------------------------
+Copyright 2012 iMinds-Vision Lab, University of Antwerp
+
+Contact: astra@ua.ac.be
+Website: http://astra.ua.ac.be
+
+
+This file is part of the
+All Scale Tomographic Reconstruction Antwerp Toolbox ("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$
+*/
+
+
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/test/test_case_template.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+
+#include "astra/Float32VolumeData2D.h"
+
+// Note: most of the features of CFloat32VolumeData2D are tested by
+// the CFloat32Data2D tests.
+
+BOOST_AUTO_TEST_CASE( testFloat32VolumeData2D_Constructor1 )
+{
+ astra::CVolumeGeometry2D geom(16, 32);
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ astra::CFloat32VolumeData2D data(&geom);
+ BOOST_REQUIRE( data.isInitialized() );
+
+ BOOST_CHECK( data.getType() == astra::CFloat32Data2D::VOLUME );
+ BOOST_CHECK( data.getGeometry()->isEqual(&geom) );
+}
+
+BOOST_AUTO_TEST_CASE( testFloat32VolumeData2D_Constructor1odd )
+{
+ astra::CVolumeGeometry2D geom(16, 32);
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ astra::CFloat32VolumeData2D data(&geom, 1.0f);
+ BOOST_REQUIRE( data.isInitialized() );
+
+ BOOST_CHECK( data.getType() == astra::CFloat32Data2D::VOLUME );
+ BOOST_CHECK( data.getGeometry()->isEqual(&geom) );
+
+ // CHECKME: should this be necessary?
+ data.updateStatistics();
+ BOOST_CHECK( data.getGlobalMax() == 1.0f );
+}
+
+BOOST_AUTO_TEST_CASE( testFloat32VolumeData2D_Constructor2 )
+{
+ astra::float32 d[] = { 1.0f, 2.0f, 3.0f, 4.0f };
+ astra::CVolumeGeometry2D geom(2, 2);
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ astra::CFloat32VolumeData2D data(&geom, d);
+ BOOST_REQUIRE( data.isInitialized() );
+
+ BOOST_CHECK( data.getType() == astra::CFloat32Data2D::VOLUME );
+
+ BOOST_CHECK( data.getGeometry()->isEqual(&geom) );
+
+ // CHECKME: should this be necessary?
+ data.updateStatistics();
+ BOOST_CHECK( data.getGlobalMax() == 4.0f );
+}
+
+BOOST_AUTO_TEST_CASE( testFloat32VolumeData2D_Clone )
+{
+ astra::float32 d[] = { 1.0f, 2.0f, 3.0f, 4.0f };
+ astra::CVolumeGeometry2D geom(2, 2);
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ astra::CFloat32VolumeData2D data(&geom, d);
+ BOOST_REQUIRE( data.isInitialized() );
+
+ astra::CFloat32VolumeData2D data2(data);
+ BOOST_REQUIRE( data2.isInitialized() );
+
+ BOOST_CHECK( data2.getGeometry()->isEqual(&geom) );
+ BOOST_CHECK( data2.getDataConst()[0] == 1.0f );
+ BOOST_CHECK( data2.getDataConst()[3] == 4.0f );
+
+ astra::CFloat32VolumeData2D data3;
+ data3 = data;
+ BOOST_REQUIRE( data3.isInitialized() );
+
+ BOOST_CHECK( data3.getGeometry()->isEqual(&geom) );
+ BOOST_CHECK( data3.getDataConst()[0] == 1.0f );
+ BOOST_CHECK( data3.getDataConst()[3] == 4.0f );
+}
diff --git a/tests/test_Fourier.cpp b/tests/test_Fourier.cpp
new file mode 100644
index 0000000..2602edb
--- /dev/null
+++ b/tests/test_Fourier.cpp
@@ -0,0 +1,182 @@
+/*
+-----------------------------------------------------------------------
+Copyright 2012 iMinds-Vision Lab, University of Antwerp
+
+Contact: astra@ua.ac.be
+Website: http://astra.ua.ac.be
+
+
+This file is part of the
+All Scale Tomographic Reconstruction Antwerp Toolbox ("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$
+*/
+
+
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/test/test_case_template.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+
+#include "astra/Fourier.h"
+
+BOOST_AUTO_TEST_CASE( testFourier_DFT_1D_1 )
+{
+ astra::float32 inR[5] = { 1.0f, 1.0f, 0.0f, 0.0f, 1.0f };
+ astra::float32 inI[5] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
+ astra::float32 outR[5];
+ astra::float32 outI[5];
+
+ astra::discreteFourierTransform1D(5, inR, inI, outR, outI, 1, 1, false);
+
+ astra::float32 expected1R[5] = { 3.0f, 1.618034f, -0.618034f, -0.618034f, 1.618034f };
+ for (unsigned int i = 0; i < 5; ++i) {
+ BOOST_CHECK_SMALL(outR[i] - expected1R[i], 0.00001f);
+ BOOST_CHECK_SMALL(outI[i], 0.00001f);
+ }
+
+ astra::discreteFourierTransform1D(5, outR, outI, inR, inI, 1, 1, true);
+ astra::float32 expected2R[5] = { 1.0f, 1.0f, 0.0f, 0.0f, 1.0f };
+ for (unsigned int i = 0; i < 5; ++i) {
+ BOOST_CHECK_SMALL(inR[i] - expected2R[i], 0.00001f);
+ BOOST_CHECK_SMALL(inI[i], 0.00001f);
+ }
+}
+
+BOOST_AUTO_TEST_CASE( testFourier_DFT_2D_1 )
+{
+ astra::float32 inR[25] = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
+ 1.0f, 1.0f, 0.0f, 0.0f, 1.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 1.0f, 1.0f, 0.0f, 0.0f, 1.0f };
+ astra::float32 inI[25] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
+ astra::float32 outR[25];
+ astra::float32 outI[25];
+
+ astra::discreteFourierTransform2D(5, 5, inR, inI, outR, outI, false);
+
+ astra::float32 expected1R[25] =
+ { 13.0f , 5.236068f, 0.763932f, 0.763932f, 5.236068f,
+ 5.236068f,-0.618034f,-2.0f ,-2.0f ,-0.618034f,
+ 0.763932f,-2.0f , 1.618034f, 1.618034f,-2.0f ,
+ 0.763932f,-2.0f , 1.618034f, 1.618034f,-2.0f ,
+ 5.236068f,-0.618034f,-2.0f ,-2.0f ,-0.618034f };
+ for (unsigned int i = 0; i < 25; ++i) {
+ BOOST_CHECK_SMALL(outR[i] - expected1R[i], 0.00001f);
+ BOOST_CHECK_SMALL(outI[i], 0.00001f);
+ }
+
+ astra::discreteFourierTransform2D(5, 5, outR, outI, inR, inI, true);
+ astra::float32 expected2R[25] = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
+ 1.0f, 1.0f, 0.0f, 0.0f, 1.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 1.0f, 1.0f, 0.0f, 0.0f, 1.0f };
+ for (unsigned int i = 0; i < 25; ++i) {
+ BOOST_CHECK_SMALL(inR[i] - expected2R[i], 0.00001f);
+ BOOST_CHECK_SMALL(inI[i], 0.00001f);
+ }
+
+
+}
+
+
+BOOST_AUTO_TEST_CASE( testFourier_FFT_1D_1 )
+{
+ astra::float32 inR[8] = { 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f };
+ astra::float32 inI[8] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
+ astra::float32 outR[5];
+ astra::float32 outI[5];
+
+ astra::fastTwoPowerFourierTransform1D(8, inR, inI, outR, outI, 1, 1, false);
+
+ astra::float32 expected1R[8] = { 5.0f, 2.414214f, -1.0f, -0.414214f, 1.0f, -0.414214f, -1.0f, 2.414214f };
+ for (unsigned int i = 0; i < 8; ++i) {
+ BOOST_CHECK_SMALL(outR[i] - expected1R[i], 0.00001f);
+ BOOST_CHECK_SMALL(outI[i], 0.00001f);
+ }
+
+ astra::fastTwoPowerFourierTransform1D(8, outR, outI, inR, inI, 1, 1, true);
+ astra::float32 expected2R[8] = { 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f };
+ for (unsigned int i = 0; i < 8; ++i) {
+ BOOST_CHECK_SMALL(inR[i] - expected2R[i], 0.00001f);
+ BOOST_CHECK_SMALL(inI[i], 0.00001f);
+ }
+
+}
+
+BOOST_AUTO_TEST_CASE( testFourier_FFT_2D_1 )
+{
+ astra::float32 inR[64] = { 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f,
+ 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f,
+ 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
+ 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f };
+ astra::float32 inI[64] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
+ astra::float32 outR[64];
+ astra::float32 outI[64];
+
+ astra::discreteFourierTransform2D(8, 8, inR, inI, outR, outI, false);
+
+ astra::float32 expected1R[64] =
+ { 25.0f, 12.656854f, 1.0f, 1.343146f, 1.0f, 1.343146f, 1.0f, 12.656854f,
+ 12.656854f, 3.0f, -3.828427f, -1.0f, -1.0f, -1.0f, -3.828427f, 3.0f,
+ 1.0f, -3.828427f, -3.0f, 1.828427f, 1.0f, 1.828427f, -3.0f, -3.828427f,
+ 1.343146f, -1.0f, 1.828427f, 3.0f, -1.0f, 3.0f, 1.828427f, -1.0f,
+ 1.0f, -1.0f, 1.0f, -1.0f, -7.0f, -1.0f, 1.0f, -1.0f,
+ 1.343146f, -1.0f, 1.828427f, 3.0f, -1.0f, 3.0f, 1.828427f, -1.0f,
+ 1.0f, -3.828427f, -3.0f, 1.828427f, 1.0f, 1.828427f, -3.0f, -3.828427f,
+ 12.656854f, 3.0f, -3.828427f, -1.0f, -1.0f, -1.0f, -3.828427f, 3.0f };
+ for (unsigned int i = 0; i < 64; ++i) {
+ BOOST_CHECK_SMALL(outR[i] - expected1R[i], 0.00002f);
+ BOOST_CHECK_SMALL(outI[i], 0.00001f);
+ }
+
+
+ astra::discreteFourierTransform2D(8, 8, outR, outI, inR, inI, true);
+ astra::float32 expected2R[64] = { 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f,
+ 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f,
+ 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
+ 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f };
+ for (unsigned int i = 0; i < 64; ++i) {
+ BOOST_CHECK_SMALL(inR[i] - expected2R[i], 0.00001f);
+ BOOST_CHECK_SMALL(inI[i], 0.00001f);
+ }
+
+
+}
+
diff --git a/tests/test_ParallelBeamLineKernelProjector2D.cpp b/tests/test_ParallelBeamLineKernelProjector2D.cpp
new file mode 100644
index 0000000..86bc54f
--- /dev/null
+++ b/tests/test_ParallelBeamLineKernelProjector2D.cpp
@@ -0,0 +1,82 @@
+/*
+-----------------------------------------------------------------------
+Copyright 2012 iMinds-Vision Lab, University of Antwerp
+
+Contact: astra@ua.ac.be
+Website: http://astra.ua.ac.be
+
+
+This file is part of the
+All Scale Tomographic Reconstruction Antwerp Toolbox ("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$
+*/
+
+
+
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+
+#include "astra/ParallelBeamLineKernelProjector2D.h"
+#include "astra/ParallelProjectionGeometry2D.h"
+#include "astra/VolumeGeometry2D.h"
+
+struct TestParallelBeamLineKernelProjector2D {
+ TestParallelBeamLineKernelProjector2D()
+ {
+ astra::float32 angles[] = { 1.0f };
+ BOOST_REQUIRE( projGeom.initialize(1, 9, 1.0f, angles) );
+ BOOST_REQUIRE( volGeom.initialize(6, 4) );
+ BOOST_REQUIRE( proj.initialize(&projGeom, &volGeom) );
+ }
+ ~TestParallelBeamLineKernelProjector2D()
+ {
+
+ }
+
+ astra::CParallelBeamLineKernelProjector2D proj;
+ astra::CParallelProjectionGeometry2D projGeom;
+ astra::CVolumeGeometry2D volGeom;
+};
+
+BOOST_FIXTURE_TEST_CASE( testParallelBeamLineKernelProjector2D_General, TestParallelBeamLineKernelProjector2D )
+{
+
+}
+
+BOOST_FIXTURE_TEST_CASE( testParallelBeamLineKernelProjector2D_Rectangle, TestParallelBeamLineKernelProjector2D )
+{
+ int iMax = proj.getProjectionWeightsCount(0);
+ BOOST_REQUIRE(iMax > 0);
+
+ astra::SPixelWeight* pPix = new astra::SPixelWeight[iMax];
+ BOOST_REQUIRE(pPix);
+
+ int iCount;
+ proj.computeSingleRayWeights(0, 4, pPix, iMax, iCount);
+ BOOST_REQUIRE(iCount <= iMax);
+
+ astra::float32 fWeight = 0;
+ for (int i = 0; i < iCount; ++i)
+ fWeight += pPix[i].m_fWeight;
+
+ BOOST_CHECK_SMALL(fWeight - 7.13037f, 0.00001f);
+}
+
+
diff --git a/tests/test_ParallelBeamLinearKernelProjector2D.cpp b/tests/test_ParallelBeamLinearKernelProjector2D.cpp
new file mode 100644
index 0000000..9100db4
--- /dev/null
+++ b/tests/test_ParallelBeamLinearKernelProjector2D.cpp
@@ -0,0 +1,172 @@
+/*
+-----------------------------------------------------------------------
+Copyright 2012 iMinds-Vision Lab, University of Antwerp
+
+Contact: astra@ua.ac.be
+Website: http://astra.ua.ac.be
+
+
+This file is part of the
+All Scale Tomographic Reconstruction Antwerp Toolbox ("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$
+*/
+
+
+
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+
+#include "astra/ParallelBeamLineKernelProjector2D.h"
+#include "astra/ParallelBeamLinearKernelProjector2D.h"
+#include "astra/ParallelBeamStripKernelProjector2D.h"
+#include "astra/ParallelProjectionGeometry2D.h"
+#include "astra/VolumeGeometry2D.h"
+#include "astra/ProjectionGeometry2D.h"
+
+#include <ctime>
+
+using astra::float32;
+
+struct TestParallelBeamLinearKernelProjector2D {
+ TestParallelBeamLinearKernelProjector2D()
+ {
+ astra::float32 angles[] = { 2.6f };
+ BOOST_REQUIRE( projGeom.initialize(1, 3, 1.0f, angles) );
+ BOOST_REQUIRE( volGeom.initialize(3, 2) );
+ BOOST_REQUIRE( proj.initialize(&projGeom, &volGeom) );
+ }
+ ~TestParallelBeamLinearKernelProjector2D()
+ {
+
+ }
+
+ astra::CParallelBeamLinearKernelProjector2D proj;
+ astra::CParallelProjectionGeometry2D projGeom;
+ astra::CVolumeGeometry2D volGeom;
+};
+
+BOOST_FIXTURE_TEST_CASE( testParallelBeamLinearKernelProjector2D_General, TestParallelBeamLinearKernelProjector2D )
+{
+
+}
+
+
+// Compute linear kernel for a single volume pixel/detector pixel combination
+float32 compute_linear_kernel(const astra::CProjectionGeometry2D& projgeom, const astra::CVolumeGeometry2D& volgeom,
+ int iX, int iY, int iDet, float32 fAngle)
+{
+ // projection of center of volume pixel on detector array
+ float32 fDetProj = (iX - (volgeom.getGridColCount()-1.0f)/2.0f ) * volgeom.getPixelLengthX() * cos(fAngle) - (iY - (volgeom.getGridRowCount()-1.0f)/2.0f ) * volgeom.getPixelLengthY() * sin(fAngle);
+
+ // start of detector pixel on detector array
+ float32 fDetStart = projgeom.indexToDetectorOffset(iDet) - 0.5f;
+
+// printf("(%d,%d,%d): %f in (%f,%f)\n", iX,iY,iDet,fDetProj, fDetStart, fDetStart+1.0f);
+
+ // projection of center of next volume pixel on detector array
+ float32 fDetStep;
+ // length of projection ray through volume pixel
+ float32 fWeight;
+
+ if (fabs(cos(fAngle)) > fabs(sin(fAngle))) {
+ fDetStep = volgeom.getPixelLengthY() * fabs(cos(fAngle));
+ fWeight = volgeom.getPixelLengthX() * 1.0f / fabs(cos(fAngle));
+ } else {
+ fDetStep = volgeom.getPixelLengthX() * fabs(sin(fAngle));
+ fWeight = volgeom.getPixelLengthY() * 1.0f / fabs(sin(fAngle));
+ }
+
+// printf("step: %f\n weight: %f\n", fDetStep, fWeight);
+
+ // center of detector pixel on detector array
+ float32 fDetCenter = fDetStart + 0.5f;
+
+ // unweighted contribution of this volume pixel:
+ // linear interpolation between
+ // fDetCenter - fDetStep |---> 0
+ // fDetCenter |---> 1
+ // fDetCenter + fDetStep |---> 0
+ float32 fBase;
+ if (fDetCenter <= fDetProj) {
+ fBase = (fDetCenter - (fDetProj - fDetStep))/fDetStep;
+ } else {
+ fBase = ((fDetProj + fDetStep) - fDetCenter)/fDetStep;
+ }
+// printf("base: %f\n", fBase);
+ if (fBase < 0) fBase = 0;
+ return fBase * fWeight;
+}
+
+BOOST_AUTO_TEST_CASE( testParallelBeamLinearKernelProjector2D_Rectangles )
+{
+ astra::CParallelBeamLinearKernelProjector2D proj;
+ astra::CParallelProjectionGeometry2D projGeom;
+ astra::CVolumeGeometry2D volGeom;
+
+ const unsigned int iRandomTestCount = 100;
+
+ unsigned int iSeed = time(0);
+ srand(iSeed);
+
+ for (unsigned int iTest = 0; iTest < iRandomTestCount; ++iTest) {
+ int iDetectorCount = 1 + (rand() % 100);
+ int iRows = 1 + (rand() % 100);
+ int iCols = 1 + (rand() % 100);
+
+
+ astra::float32 angles[] = { rand() * 2.0f*astra::PI / RAND_MAX };
+ projGeom.initialize(1, iDetectorCount, 0.8f, angles);
+ volGeom.initialize(iCols, iRows);
+ proj.initialize(&projGeom, &volGeom);
+
+ int iMax = proj.getProjectionWeightsCount(0);
+ BOOST_REQUIRE(iMax > 0);
+
+ astra::SPixelWeight* pPix = new astra::SPixelWeight[iMax];
+ BOOST_REQUIRE(pPix);
+
+ astra::float32 fWeight = 0;
+ for (int iDet = 0; iDet < projGeom.getDetectorCount(); ++iDet) {
+ int iCount;
+ proj.computeSingleRayWeights(0, iDet, pPix, iMax, iCount);
+ BOOST_REQUIRE(iCount <= iMax);
+
+ astra::float32 fW = 0;
+ for (int i = 0; i < iCount; ++i) {
+ float32 fTest = compute_linear_kernel(
+ projGeom,
+ volGeom,
+ pPix[i].m_iIndex % volGeom.getGridColCount(),
+ pPix[i].m_iIndex / volGeom.getGridColCount(),
+ iDet,
+ projGeom.getProjectionAngle(0));
+ BOOST_CHECK_SMALL( pPix[i].m_fWeight - fTest, 0.00037f);
+ fW += pPix[i].m_fWeight;
+ }
+
+ fWeight += fW;
+
+ }
+
+ delete[] pPix;
+ }
+}
+
+
diff --git a/tests/test_ParallelProjectionGeometry2D.cpp b/tests/test_ParallelProjectionGeometry2D.cpp
new file mode 100644
index 0000000..809c6fa
--- /dev/null
+++ b/tests/test_ParallelProjectionGeometry2D.cpp
@@ -0,0 +1,120 @@
+/*
+-----------------------------------------------------------------------
+Copyright 2012 iMinds-Vision Lab, University of Antwerp
+
+Contact: astra@ua.ac.be
+Website: http://astra.ua.ac.be
+
+
+This file is part of the
+All Scale Tomographic Reconstruction Antwerp Toolbox ("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$
+*/
+
+
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/test/test_case_template.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+
+#include "astra/ParallelProjectionGeometry2D.h"
+
+BOOST_AUTO_TEST_CASE( testParallelProjectionGeometry2D_Constructor )
+{
+ astra::float32 angles[] = { 0.0f, 1.0f, 2.0f, 3.0f };
+ astra::CParallelProjectionGeometry2D geom(4, 8, 0.5f, angles);
+
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ BOOST_CHECK( geom.getProjectionAngleCount() == 4 );
+ BOOST_CHECK( geom.getDetectorCount() == 8 );
+ BOOST_CHECK( geom.getDetectorWidth() == 0.5f );
+ BOOST_CHECK( geom.getProjectionAngle(0) == 0.0f );
+ BOOST_CHECK( geom.getProjectionAngle(1) == 1.0f );
+ BOOST_CHECK( geom.getProjectionAngle(2) == 2.0f );
+ BOOST_CHECK( geom.getProjectionAngle(3) == 3.0f );
+ BOOST_CHECK( geom.getProjectionAngles()[0] == 0.0f );
+ BOOST_CHECK( geom.getProjectionAngles()[3] == 3.0f );
+}
+
+BOOST_AUTO_TEST_CASE( testParallelProjectionGeometry2D_Offsets )
+{
+ astra::float32 angles[] = { 0.0f, 1.0f, 2.0f, 3.0f };
+ astra::CParallelProjectionGeometry2D geom(4, 8, 0.5f, angles);
+
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ BOOST_CHECK_SMALL( geom.getProjectionAngleDegrees(2) - 114.59155902f, 1e-5f );
+
+ BOOST_CHECK( geom.detectorOffsetToIndexFloat(0.0f) == 3.5f );
+ BOOST_CHECK( geom.detectorOffsetToIndexFloat(0.625f) == 4.75f );
+ BOOST_CHECK( geom.detectorOffsetToIndex(-0.1f) == 3 );
+
+ BOOST_CHECK( geom.indexToDetectorOffset(0) == -1.75f );
+ BOOST_CHECK( geom.indexToDetectorOffset(1) == -1.25f );
+
+ int angle, detector;
+ geom.indexToAngleDetectorIndex(10, angle, detector);
+ BOOST_CHECK( angle == 1 );
+ BOOST_CHECK( detector == 2 );
+
+ float t, theta;
+ geom.getRayParams(1, 2, t, theta);
+ BOOST_CHECK( theta == 1.0f );
+ BOOST_CHECK( t == -0.75f );
+
+ // TODO: add test with large angle
+}
+
+BOOST_AUTO_TEST_CASE( testParallelProjectionGeometry2D_Offsets_odd )
+{
+ astra::float32 angles[] = { 0.0f, 1.0f, 2.0f, 3.0f };
+ astra::CParallelProjectionGeometry2D geom(4, 7, 0.5f, angles);
+
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ BOOST_CHECK( geom.detectorOffsetToIndexFloat(0.0f) == 3.0f );
+ BOOST_CHECK( geom.detectorOffsetToIndexFloat(0.625f) == 4.25f );
+}
+
+
+BOOST_AUTO_TEST_CASE( testParallelProjectionGeometry2D_Clone )
+{
+ astra::float32 angles[] = { 0.0f, 1.0f, 2.0f, 3.0f };
+ astra::CParallelProjectionGeometry2D geom(4, 8, 0.5f, angles);
+
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ astra::CProjectionGeometry2D* geom2 = geom.clone();
+
+ BOOST_REQUIRE( geom2->isInitialized() );
+
+ BOOST_CHECK( geom.isEqual(geom2) );
+ BOOST_CHECK( geom2->getProjectionAngleCount() == 4 );
+ BOOST_CHECK( geom2->getDetectorCount() == 8 );
+ BOOST_CHECK( geom2->getDetectorWidth() == 0.5f );
+ BOOST_CHECK( geom2->getProjectionAngle(0) == 0.0f );
+ BOOST_CHECK( geom2->getProjectionAngle(1) == 1.0f );
+ BOOST_CHECK( geom2->getProjectionAngle(2) == 2.0f );
+ BOOST_CHECK( geom2->getProjectionAngle(3) == 3.0f );
+ BOOST_CHECK( geom2->getProjectionAngles()[0] == 0.0f );
+ BOOST_CHECK( geom2->getProjectionAngles()[3] == 3.0f );
+ delete geom2;
+}
+
diff --git a/tests/test_VolumeGeometry2D.cpp b/tests/test_VolumeGeometry2D.cpp
new file mode 100644
index 0000000..4ae88d3
--- /dev/null
+++ b/tests/test_VolumeGeometry2D.cpp
@@ -0,0 +1,150 @@
+/*
+-----------------------------------------------------------------------
+Copyright 2012 iMinds-Vision Lab, University of Antwerp
+
+Contact: astra@ua.ac.be
+Website: http://astra.ua.ac.be
+
+
+This file is part of the
+All Scale Tomographic Reconstruction Antwerp Toolbox ("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$
+*/
+
+
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/test/test_case_template.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+
+#include "astra/VolumeGeometry2D.h"
+
+BOOST_AUTO_TEST_CASE( testVolumeGeometry2D_Constructor1 )
+{
+ astra::CVolumeGeometry2D geom(16, 32);
+
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ BOOST_CHECK( geom.getGridColCount() == 16 );
+ BOOST_CHECK( geom.getGridRowCount() == 32 );
+ BOOST_CHECK( geom.getGridTotCount() == 512 );
+ BOOST_CHECK( geom.getWindowLengthX() == 16.0f );
+ BOOST_CHECK( geom.getWindowLengthY() == 32.0f );
+ BOOST_CHECK( geom.getWindowArea() == 512.0f );
+ BOOST_CHECK( geom.getPixelLengthX() == 1.0f );
+ BOOST_CHECK( geom.getPixelLengthY() == 1.0f );
+ BOOST_CHECK( geom.getPixelArea() == 1.0f );
+ BOOST_CHECK( geom.getWindowMinX() == -8.0f );
+ BOOST_CHECK( geom.getWindowMaxX() == 8.0f );
+ BOOST_CHECK( geom.getWindowMinY() == -16.0f );
+ BOOST_CHECK( geom.getWindowMaxY() == 16.0f );
+}
+
+BOOST_AUTO_TEST_CASE( testVolumeGeometry2D_Constructor1odd )
+{
+ astra::CVolumeGeometry2D geom(5, 7);
+
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ BOOST_CHECK( geom.getGridColCount() == 5 );
+ BOOST_CHECK( geom.getGridRowCount() == 7 );
+ BOOST_CHECK( geom.getGridTotCount() == 35 );
+ BOOST_CHECK( geom.getWindowLengthX() == 5.0f );
+ BOOST_CHECK( geom.getWindowLengthY() == 7.0f );
+ BOOST_CHECK( geom.getWindowArea() == 35.0f );
+ BOOST_CHECK( geom.getPixelLengthX() == 1.0f );
+ BOOST_CHECK( geom.getPixelLengthY() == 1.0f );
+ BOOST_CHECK( geom.getPixelArea() == 1.0f );
+ BOOST_CHECK( geom.getWindowMinX() == -2.5f );
+ BOOST_CHECK( geom.getWindowMaxX() == 2.5f );
+ BOOST_CHECK( geom.getWindowMinY() == -3.5f );
+ BOOST_CHECK( geom.getWindowMaxY() == 3.5f );
+}
+
+BOOST_AUTO_TEST_CASE( testVolumeGeometry2D_Constructor2 )
+{
+ astra::CVolumeGeometry2D geom(16, 32, -1.0f, -2.0f, 3.0f, 4.0f);
+
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ BOOST_CHECK( geom.getGridColCount() == 16 );
+ BOOST_CHECK( geom.getGridRowCount() == 32 );
+ BOOST_CHECK( geom.getGridTotCount() == 512 );
+ BOOST_CHECK( geom.getWindowLengthX() == 4.0f );
+ BOOST_CHECK( geom.getWindowLengthY() == 6.0f );
+ BOOST_CHECK( geom.getWindowArea() == 24.0f );
+ BOOST_CHECK( geom.getPixelLengthX() == 0.25f );
+ BOOST_CHECK( geom.getPixelLengthY() == 0.1875f );
+ BOOST_CHECK( geom.getPixelArea() == 0.046875f );
+ BOOST_CHECK( geom.getWindowMinX() == -1.0f );
+ BOOST_CHECK( geom.getWindowMaxX() == 3.0f );
+ BOOST_CHECK( geom.getWindowMinY() == -2.0f );
+ BOOST_CHECK( geom.getWindowMaxY() == 4.0f );
+}
+
+BOOST_AUTO_TEST_CASE( testVolumeGeometry2D_Clone )
+{
+ astra::CVolumeGeometry2D geom(16, 32, -1.0f, -2.0f, 3.0f, 4.0f);
+
+ astra::CVolumeGeometry2D* geom2 = geom.clone();
+
+ BOOST_REQUIRE( geom2->isInitialized() );
+
+ BOOST_CHECK( geom.isEqual(geom2) );
+ BOOST_CHECK( geom2->getGridColCount() == 16 );
+ BOOST_CHECK( geom2->getGridRowCount() == 32 );
+ BOOST_CHECK( geom2->getGridTotCount() == 512 );
+ BOOST_CHECK( geom2->getWindowLengthX() == 4.0f );
+ BOOST_CHECK( geom2->getWindowLengthY() == 6.0f );
+ BOOST_CHECK( geom2->getWindowArea() == 24.0f );
+ BOOST_CHECK( geom2->getPixelLengthX() == 0.25f );
+ BOOST_CHECK( geom2->getPixelLengthY() == 0.1875f );
+ BOOST_CHECK( geom2->getPixelArea() == 0.046875f );
+ BOOST_CHECK( geom2->getWindowMinX() == -1.0f );
+ BOOST_CHECK( geom2->getWindowMaxX() == 3.0f );
+ BOOST_CHECK( geom2->getWindowMinY() == -2.0f );
+ BOOST_CHECK( geom2->getWindowMaxY() == 4.0f );
+
+ delete geom2;
+}
+
+BOOST_AUTO_TEST_CASE( testVolumeGeometry2D_Offsets )
+{
+ astra::CVolumeGeometry2D geom(16, 32, -1.0f, -2.0f, 3.0f, 4.0f);
+
+ BOOST_REQUIRE( geom.isInitialized() );
+
+ BOOST_CHECK( geom.pixelRowColToIndex(1,2) == 18 );
+
+ int r,c;
+ geom.pixelIndexToRowCol(66, r, c);
+ BOOST_CHECK( r == 4 );
+ BOOST_CHECK( c == 2 );
+
+ BOOST_CHECK( geom.pixelColToCenterX(2) == -0.375f );
+ BOOST_CHECK( geom.pixelColToMinX(2) == -0.5f );
+ BOOST_CHECK( geom.pixelColToMaxX(2) == -0.25f );
+
+ BOOST_CHECK( geom.pixelRowToCenterY(29) == -1.53125f );
+ BOOST_CHECK( geom.pixelRowToMinY(29) == -1.625f );
+ BOOST_CHECK( geom.pixelRowToMaxY(29) == -1.4375f );
+
+ BOOST_CHECK( geom.coordXToCol(0.1f) == 4 );
+ BOOST_CHECK( geom.coordYToRow(0.1f) == 20 );
+}
diff --git a/tests/test_XMLDocument.cpp b/tests/test_XMLDocument.cpp
new file mode 100644
index 0000000..adabdd6
--- /dev/null
+++ b/tests/test_XMLDocument.cpp
@@ -0,0 +1,158 @@
+/*
+-----------------------------------------------------------------------
+Copyright 2012 iMinds-Vision Lab, University of Antwerp
+
+Contact: astra@ua.ac.be
+Website: http://astra.ua.ac.be
+
+
+This file is part of the
+All Scale Tomographic Reconstruction Antwerp Toolbox ("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$
+*/
+
+
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+#include <boost/test/auto_unit_test.hpp>
+
+#include "astra/XMLDocument.h"
+
+BOOST_AUTO_TEST_CASE( testXMLDocument_Constructor1 )
+{
+ astra::XMLDocument *doc = astra::XMLDocument::createDocument("test");
+ BOOST_REQUIRE(doc);
+
+ astra::XMLNode *root = doc->getRootNode();
+
+ BOOST_REQUIRE(root);
+
+ BOOST_CHECK(root->getName() == "test");
+ BOOST_CHECK(root->getContent().empty());
+}
+
+BOOST_AUTO_TEST_CASE( testXMLDocument_FileIO )
+{
+ astra::XMLDocument *doc = astra::XMLDocument::createDocument("test");
+
+ doc->saveToFile("test.xml");
+
+ astra::XMLDocument *doc2 = astra::XMLDocument::readFromFile("test.xml");
+ astra::XMLNode *root = doc2->getRootNode();
+
+ BOOST_REQUIRE(root);
+
+ BOOST_CHECK(root->getName() == "test");
+ BOOST_CHECK(root->getContent().empty());
+
+}
+
+BOOST_AUTO_TEST_CASE( testXMLDocument_CreateNodes )
+{
+ astra::XMLDocument *doc = astra::XMLDocument::createDocument("test");
+ BOOST_REQUIRE(doc);
+
+ astra::XMLNode *root = doc->getRootNode();
+ BOOST_REQUIRE(root);
+
+ astra::XMLNode *node = root->addChildNode("child");
+ BOOST_REQUIRE(node);
+
+ node->addAttribute("attr", "val");
+
+ doc->saveToFile("test2.xml");
+
+ delete node;
+ delete root;
+ delete doc;
+
+ doc = astra::XMLDocument::readFromFile("test2.xml");
+ BOOST_REQUIRE(doc);
+ root = doc->getRootNode();
+ BOOST_REQUIRE(node);
+ node = root->getSingleNode("child");
+ BOOST_REQUIRE(node);
+
+ BOOST_CHECK(node->hasAttribute("attr"));
+ BOOST_CHECK(node->getAttribute("attr") == "val");
+
+ delete node;
+ delete root;
+ delete doc;
+}
+
+BOOST_AUTO_TEST_CASE( testXMLDocument_Options )
+{
+ astra::XMLDocument *doc = astra::XMLDocument::createDocument("test");
+ BOOST_REQUIRE(doc);
+
+ astra::XMLNode *root = doc->getRootNode();
+ BOOST_REQUIRE(root);
+
+ BOOST_CHECK(!root->hasOption("opt"));
+
+ root->addOption("opt", "val");
+
+ BOOST_CHECK(root->hasOption("opt"));
+
+ BOOST_CHECK(root->getOption("opt") == "val");
+
+}
+
+BOOST_AUTO_TEST_CASE( testXMLDocument_List )
+{
+ astra::XMLDocument *doc = astra::XMLDocument::createDocument("test");
+ BOOST_REQUIRE(doc);
+
+ astra::XMLNode *root = doc->getRootNode();
+ BOOST_REQUIRE(root);
+
+ astra::XMLNode *node = root->addChildNode("child");
+ BOOST_REQUIRE(node);
+
+
+ float fl[] = { 1.0, 3.5, 2.0, 4.75 };
+
+ node->setContent(fl, sizeof(fl)/sizeof(fl[0]));
+
+ doc->saveToFile("test3.xml");
+
+ delete node;
+ delete root;
+ delete doc;
+
+ doc = astra::XMLDocument::readFromFile("test3.xml");
+ BOOST_REQUIRE(doc);
+ root = doc->getRootNode();
+ BOOST_REQUIRE(root);
+ node = root->getSingleNode("child");
+ BOOST_REQUIRE(node);
+
+ std::vector<astra::float32> f = node->getContentNumericalArray();
+
+ BOOST_CHECK(f[0] == fl[0]);
+ BOOST_CHECK(f[1] == fl[1]);
+ BOOST_CHECK(f[2] == fl[2]);
+ BOOST_CHECK(f[3] == fl[3]);
+
+ delete node;
+ delete root;
+ delete doc;
+
+}
+
diff --git a/tests/tests_vc08.vcproj b/tests/tests_vc08.vcproj
new file mode 100644
index 0000000..90c5d55
--- /dev/null
+++ b/tests/tests_vc08.vcproj
@@ -0,0 +1,699 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="tests"
+ ProjectGUID="{32C1BDD3-38C2-4C80-A03C-2129782F59B5}"
+ RootNamespace="tests"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)\tests\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)\obj\"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\lib\include\;..\include\"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="0"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Astra32D.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="..\lib\win32\;..\bin\win32"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(SolutionDir)\tests\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)\obj\"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\lib\include\;..\include\"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="0"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Astra64D.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="..\lib\x64\;..\bin\x64"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)\tests\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)\obj\"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\lib\include\;..\include\"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Astra32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="..\lib\win32\;..\bin\win32"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(SolutionDir)\tests\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)\obj\"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\lib\include\;..\include\"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Astra64.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="..\lib\x64\;..\bin\x64"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_CUDA|Win32"
+ OutputDirectory="$(SolutionDir)\tests\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)\obj\"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\lib\include\;..\include\"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="0"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="AstraCuda32D.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="..\lib\win32\;..\bin\win32"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_CUDA|x64"
+ OutputDirectory="$(SolutionDir)\tests\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)\obj\"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\lib\include\;..\include\"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="0"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="AstraCuda64D.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="..\lib\x64\;..\bin\x64"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_CUDA|Win32"
+ OutputDirectory="$(SolutionDir)\tests\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)\obj\"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\lib\include\;..\include\"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="AstraCuda32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="..\lib\win32\;..\bin\win32"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_CUDA|x64"
+ OutputDirectory="$(SolutionDir)\tests\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)\obj\"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\lib\include\;..\include\"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="AstraCuda64.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="..\lib\x64\;..\bin\x64"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Test Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\test_FanFlatProjectionGeometry2D.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\test_Float32Data2D.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\test_Float32ProjectionData2D.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\test_Float32VolumeData2D.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\test_Fourier.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\test_ParallelBeamLinearKernelProjector2D.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\test_ParallelBeamLineKernelProjector2D.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\test_ParallelProjectionGeometry2D.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\test_VolumeGeometry2D.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Main"
+ >
+ <File
+ RelativePath=".\main.cpp"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>