From 71db6331f8dd0d5abbeee92977af01293be4f427 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 28 Nov 2016 15:54:07 +0100 Subject: Update headers (website+2016) --- tests/main.cpp | 12 +- tests/test_AstraObjectManager.cpp | 12 +- tests/test_FanFlatProjectionGeometry2D.cpp | 11 +- tests/test_Float32Data2D.cpp | 11 +- tests/test_Float32ProjectionData2D.cpp | 11 +- tests/test_Float32VolumeData2D.cpp | 11 +- tests/test_Fourier.cpp | 11 +- tests/test_ParallelBeamLineKernelProjector2D.cpp | 12 +- tests/test_ParallelBeamLinearKernelProjector2D.cpp | 12 +- tests/test_ParallelProjectionGeometry2D.cpp | 11 +- tests/test_VolumeGeometry2D.cpp | 11 +- tests/test_XMLDocument.cpp | 11 +- tests/tests_vc08.vcproj | 699 --------------------- 13 files changed, 60 insertions(+), 775 deletions(-) delete mode 100644 tests/tests_vc08.vcproj (limited to 'tests') diff --git a/tests/main.cpp b/tests/main.cpp index 6fc963e..cd2f717 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,13 +1,13 @@ /* ----------------------------------------------------------------------- -Copyright 2012 iMinds-Vision Lab, University of Antwerp +Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp + 2014-2016, CWI, Amsterdam -Contact: astra@ua.ac.be -Website: http://astra.ua.ac.be +Contact: astra@uantwerpen.be +Website: http://www.astra-toolbox.com/ +This file is part of the ASTRA Toolbox. -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 @@ -23,11 +23,9 @@ You should have received a copy of the GNU General Public License along with the ASTRA Toolbox. If not, see . ----------------------------------------------------------------------- -$Id$ */ - #define BOOST_TEST_DYN_LINK // Generate main() diff --git a/tests/test_AstraObjectManager.cpp b/tests/test_AstraObjectManager.cpp index 893efb9..da641ba 100644 --- a/tests/test_AstraObjectManager.cpp +++ b/tests/test_AstraObjectManager.cpp @@ -1,13 +1,13 @@ /* ----------------------------------------------------------------------- -Copyright 2012 iMinds-Vision Lab, University of Antwerp +Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp + 2014-2016, CWI, Amsterdam -Contact: astra@ua.ac.be -Website: http://astra.ua.ac.be +Contact: astra@uantwerpen.be +Website: http://www.astra-toolbox.com/ +This file is part of the ASTRA Toolbox. -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 @@ -23,10 +23,8 @@ You should have received a copy of the GNU General Public License along with the ASTRA Toolbox. If not, see . ----------------------------------------------------------------------- -$Id$ */ - #define BOOST_TEST_DYN_LINK #include #include diff --git a/tests/test_FanFlatProjectionGeometry2D.cpp b/tests/test_FanFlatProjectionGeometry2D.cpp index a07fbf8..b7c5601 100644 --- a/tests/test_FanFlatProjectionGeometry2D.cpp +++ b/tests/test_FanFlatProjectionGeometry2D.cpp @@ -1,13 +1,13 @@ /* ----------------------------------------------------------------------- -Copyright 2012 iMinds-Vision Lab, University of Antwerp +Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp + 2014-2016, CWI, Amsterdam -Contact: astra@ua.ac.be -Website: http://astra.ua.ac.be +Contact: astra@uantwerpen.be +Website: http://www.astra-toolbox.com/ +This file is part of the ASTRA Toolbox. -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 @@ -23,7 +23,6 @@ You should have received a copy of the GNU General Public License along with the ASTRA Toolbox. If not, see . ----------------------------------------------------------------------- -$Id$ */ diff --git a/tests/test_Float32Data2D.cpp b/tests/test_Float32Data2D.cpp index 54d642b..31e3d03 100644 --- a/tests/test_Float32Data2D.cpp +++ b/tests/test_Float32Data2D.cpp @@ -1,13 +1,13 @@ /* ----------------------------------------------------------------------- -Copyright 2012 iMinds-Vision Lab, University of Antwerp +Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp + 2014-2016, CWI, Amsterdam -Contact: astra@ua.ac.be -Website: http://astra.ua.ac.be +Contact: astra@uantwerpen.be +Website: http://www.astra-toolbox.com/ +This file is part of the ASTRA Toolbox. -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 @@ -23,7 +23,6 @@ You should have received a copy of the GNU General Public License along with the ASTRA Toolbox. If not, see . ----------------------------------------------------------------------- -$Id$ */ diff --git a/tests/test_Float32ProjectionData2D.cpp b/tests/test_Float32ProjectionData2D.cpp index 1fddeec..75b276f 100644 --- a/tests/test_Float32ProjectionData2D.cpp +++ b/tests/test_Float32ProjectionData2D.cpp @@ -1,13 +1,13 @@ /* ----------------------------------------------------------------------- -Copyright 2012 iMinds-Vision Lab, University of Antwerp +Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp + 2014-2016, CWI, Amsterdam -Contact: astra@ua.ac.be -Website: http://astra.ua.ac.be +Contact: astra@uantwerpen.be +Website: http://www.astra-toolbox.com/ +This file is part of the ASTRA Toolbox. -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 @@ -23,7 +23,6 @@ You should have received a copy of the GNU General Public License along with the ASTRA Toolbox. If not, see . ----------------------------------------------------------------------- -$Id$ */ diff --git a/tests/test_Float32VolumeData2D.cpp b/tests/test_Float32VolumeData2D.cpp index 29dde3a..c667f51 100644 --- a/tests/test_Float32VolumeData2D.cpp +++ b/tests/test_Float32VolumeData2D.cpp @@ -1,13 +1,13 @@ /* ----------------------------------------------------------------------- -Copyright 2012 iMinds-Vision Lab, University of Antwerp +Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp + 2014-2016, CWI, Amsterdam -Contact: astra@ua.ac.be -Website: http://astra.ua.ac.be +Contact: astra@uantwerpen.be +Website: http://www.astra-toolbox.com/ +This file is part of the ASTRA Toolbox. -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 @@ -23,7 +23,6 @@ You should have received a copy of the GNU General Public License along with the ASTRA Toolbox. If not, see . ----------------------------------------------------------------------- -$Id$ */ diff --git a/tests/test_Fourier.cpp b/tests/test_Fourier.cpp index ef12747..611bd56 100644 --- a/tests/test_Fourier.cpp +++ b/tests/test_Fourier.cpp @@ -1,13 +1,13 @@ /* ----------------------------------------------------------------------- -Copyright 2012 iMinds-Vision Lab, University of Antwerp +Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp + 2014-2016, CWI, Amsterdam -Contact: astra@ua.ac.be -Website: http://astra.ua.ac.be +Contact: astra@uantwerpen.be +Website: http://www.astra-toolbox.com/ +This file is part of the ASTRA Toolbox. -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 @@ -23,7 +23,6 @@ You should have received a copy of the GNU General Public License along with the ASTRA Toolbox. If not, see . ----------------------------------------------------------------------- -$Id$ */ diff --git a/tests/test_ParallelBeamLineKernelProjector2D.cpp b/tests/test_ParallelBeamLineKernelProjector2D.cpp index c56ff37..58d511e 100644 --- a/tests/test_ParallelBeamLineKernelProjector2D.cpp +++ b/tests/test_ParallelBeamLineKernelProjector2D.cpp @@ -1,13 +1,13 @@ /* ----------------------------------------------------------------------- -Copyright 2012 iMinds-Vision Lab, University of Antwerp +Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp + 2014-2016, CWI, Amsterdam -Contact: astra@ua.ac.be -Website: http://astra.ua.ac.be +Contact: astra@uantwerpen.be +Website: http://www.astra-toolbox.com/ +This file is part of the ASTRA Toolbox. -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 @@ -23,11 +23,9 @@ You should have received a copy of the GNU General Public License along with the ASTRA Toolbox. If not, see . ----------------------------------------------------------------------- -$Id$ */ - #define BOOST_TEST_DYN_LINK #include #include diff --git a/tests/test_ParallelBeamLinearKernelProjector2D.cpp b/tests/test_ParallelBeamLinearKernelProjector2D.cpp index 9100db4..f1fa311 100644 --- a/tests/test_ParallelBeamLinearKernelProjector2D.cpp +++ b/tests/test_ParallelBeamLinearKernelProjector2D.cpp @@ -1,13 +1,13 @@ /* ----------------------------------------------------------------------- -Copyright 2012 iMinds-Vision Lab, University of Antwerp +Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp + 2014-2016, CWI, Amsterdam -Contact: astra@ua.ac.be -Website: http://astra.ua.ac.be +Contact: astra@uantwerpen.be +Website: http://www.astra-toolbox.com/ +This file is part of the ASTRA Toolbox. -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 @@ -23,11 +23,9 @@ You should have received a copy of the GNU General Public License along with the ASTRA Toolbox. If not, see . ----------------------------------------------------------------------- -$Id$ */ - #define BOOST_TEST_DYN_LINK #include #include diff --git a/tests/test_ParallelProjectionGeometry2D.cpp b/tests/test_ParallelProjectionGeometry2D.cpp index 809c6fa..fe353f0 100644 --- a/tests/test_ParallelProjectionGeometry2D.cpp +++ b/tests/test_ParallelProjectionGeometry2D.cpp @@ -1,13 +1,13 @@ /* ----------------------------------------------------------------------- -Copyright 2012 iMinds-Vision Lab, University of Antwerp +Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp + 2014-2016, CWI, Amsterdam -Contact: astra@ua.ac.be -Website: http://astra.ua.ac.be +Contact: astra@uantwerpen.be +Website: http://www.astra-toolbox.com/ +This file is part of the ASTRA Toolbox. -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 @@ -23,7 +23,6 @@ You should have received a copy of the GNU General Public License along with the ASTRA Toolbox. If not, see . ----------------------------------------------------------------------- -$Id$ */ diff --git a/tests/test_VolumeGeometry2D.cpp b/tests/test_VolumeGeometry2D.cpp index 4ae88d3..96e8e5e 100644 --- a/tests/test_VolumeGeometry2D.cpp +++ b/tests/test_VolumeGeometry2D.cpp @@ -1,13 +1,13 @@ /* ----------------------------------------------------------------------- -Copyright 2012 iMinds-Vision Lab, University of Antwerp +Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp + 2014-2016, CWI, Amsterdam -Contact: astra@ua.ac.be -Website: http://astra.ua.ac.be +Contact: astra@uantwerpen.be +Website: http://www.astra-toolbox.com/ +This file is part of the ASTRA Toolbox. -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 @@ -23,7 +23,6 @@ You should have received a copy of the GNU General Public License along with the ASTRA Toolbox. If not, see . ----------------------------------------------------------------------- -$Id$ */ diff --git a/tests/test_XMLDocument.cpp b/tests/test_XMLDocument.cpp index 95429cb..f213006 100644 --- a/tests/test_XMLDocument.cpp +++ b/tests/test_XMLDocument.cpp @@ -1,13 +1,13 @@ /* ----------------------------------------------------------------------- -Copyright 2012 iMinds-Vision Lab, University of Antwerp +Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp + 2014-2016, CWI, Amsterdam -Contact: astra@ua.ac.be -Website: http://astra.ua.ac.be +Contact: astra@uantwerpen.be +Website: http://www.astra-toolbox.com/ +This file is part of the ASTRA Toolbox. -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 @@ -23,7 +23,6 @@ You should have received a copy of the GNU General Public License along with the ASTRA Toolbox. If not, see . ----------------------------------------------------------------------- -$Id$ */ diff --git a/tests/tests_vc08.vcproj b/tests/tests_vc08.vcproj deleted file mode 100644 index 90c5d55..0000000 --- a/tests/tests_vc08.vcproj +++ /dev/null @@ -1,699 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3 From bba67ebac5f05aed001d8e205e0e2220004252d9 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 28 Nov 2016 19:03:36 +0100 Subject: Fix AstraObjectManager test --- tests/test_AstraObjectManager.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/test_AstraObjectManager.cpp b/tests/test_AstraObjectManager.cpp index da641ba..39652f1 100644 --- a/tests/test_AstraObjectManager.cpp +++ b/tests/test_AstraObjectManager.cpp @@ -31,19 +31,35 @@ along with the ASTRA Toolbox. If not, see . #include "astra/AstraObjectManager.h" +struct TestT { + TestT(int _x) : x(_x) { } + bool operator==(int _x) const { return x == _x; } + + int x; + bool isInitialized() const { return true; } + std::string description() const { return ""; } +}; + namespace astra { -DEFINE_SINGLETON(CAstraObjectManager); + +class CTestManager : public Singleton, public CAstraObjectManager +{ + virtual std::string getType() const { return "test"; } +}; + +DEFINE_SINGLETON(CTestManager); + } BOOST_AUTO_TEST_CASE( testAstraObjectManager ) { - astra::CAstraObjectManager man; + astra::CTestManager &man = astra::CTestManager::getSingleton(); - int i1 = man.store(new int(1)); + int i1 = man.store(new TestT(1)); BOOST_REQUIRE(man.hasIndex(i1)); BOOST_CHECK(*(man.get(i1)) == 1); - int i2 = man.store(new int(2)); + int i2 = man.store(new TestT(2)); BOOST_REQUIRE(man.hasIndex(i2)); BOOST_CHECK(*(man.get(i1)) == 1); BOOST_CHECK(*(man.get(i2)) == 2); @@ -53,12 +69,12 @@ BOOST_AUTO_TEST_CASE( testAstraObjectManager ) BOOST_CHECK(!man.hasIndex(i1)); BOOST_REQUIRE(man.hasIndex(i2)); - int i3 = man.store(new int(3)); + int i3 = man.store(new TestT(3)); BOOST_REQUIRE(man.hasIndex(i3)); BOOST_CHECK(*(man.get(i2)) == 2); BOOST_CHECK(*(man.get(i3)) == 3); - int* pi4 = new int(4); + TestT* pi4 = new TestT(4); int i4 = man.store(pi4); BOOST_REQUIRE(man.hasIndex(i4)); BOOST_CHECK(*(man.get(i2)) == 2); -- cgit v1.2.3 From 341e020c885202a543feb2f5d0fa75ac566ea0e9 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 28 Nov 2016 19:17:54 +0100 Subject: Fix Fourier test --- tests/test_Fourier.cpp | 147 ++++--------------------------------------------- 1 file changed, 12 insertions(+), 135 deletions(-) (limited to 'tests') diff --git a/tests/test_Fourier.cpp b/tests/test_Fourier.cpp index 611bd56..cf05991 100644 --- a/tests/test_Fourier.cpp +++ b/tests/test_Fourier.cpp @@ -34,148 +34,25 @@ along with the ASTRA Toolbox. If not, see . #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[8]; - astra::float32 outI[8]; + astra::float32 data[16] = { 1.0f,0.0f, 1.0f,0.0f, 1.0f,0.0f, 0.0f,0.0f, 0.0f,0.0f, 0.0f,0.0f, 1.0f,0.0f, 1.0f,0.0f }; + int ip[6]; + astra::float32 w[8]; + ip[0] = 0; - astra::fastTwoPowerFourierTransform1D(8, inR, inI, outR, outI, 1, 1, false); + astra::cdft(16, -1, data, ip, w); - 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::float32 expected1[16] = { 5.0f,0.0f, 2.414214f,0.0f, -1.0f,0.0f, -0.414214f,0.0f, 1.0f,0.0f, -0.414214f,0.0f, -1.0f,0.0f, 2.414214f,0.0f }; + for (unsigned int i = 0; i < 16; ++i) { + BOOST_CHECK_SMALL(data[i] - expected1[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); + astra::cdft(16, 1, data, ip, w); + astra::float32 expected2[16] = { 8.0f,0.0f, 8.0f,0.0f, 8.0f,0.0f, 0.0f,0.0f, 0.0f,0.0f, 0.0f,0.0f, 8.0f,0.0f, 8.0f,0.0f }; + for (unsigned int i = 0; i < 16; ++i) { + BOOST_CHECK_SMALL(data[i] - expected2[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); - } - - -} - -- cgit v1.2.3 From 94a1230e6e8033b75f91f7cecfb9f16878508da7 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 27 Mar 2017 16:55:00 +0200 Subject: Fix compile error --- tests/test_FanFlatProjectionGeometry2D.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/test_FanFlatProjectionGeometry2D.cpp b/tests/test_FanFlatProjectionGeometry2D.cpp index b7c5601..9980bad 100644 --- a/tests/test_FanFlatProjectionGeometry2D.cpp +++ b/tests/test_FanFlatProjectionGeometry2D.cpp @@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE( testFanFlatProjectionGeometry2D_Offsets ) float t, theta; geom.getRayParams(0, 2, t, theta); - BOOST_CHECK_SMALL( tan(theta) + 0.25f, astra::eps ); + BOOST_CHECK_SMALL( tan(theta) + 0.25f, (double)astra::eps ); BOOST_CHECK_SMALL( 17.0f*t*t - 1.0f, astra::eps ); // TODO: add test with large angle -- cgit v1.2.3