25 #ifndef WDATASETDTI_TEST_H
26 #define WDATASETDTI_TEST_H
30 #include <cxxtest/TestSuite.h>
32 #include "../../common/math/test/WTensorTraits.h"
33 #include "../../common/WLogger.h"
34 #include "../WDataSetDTI.h"
35 #include "../WGridRegular3D.h"
56 float dataArray[6] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 };
57 boost::shared_ptr< std::vector< float > > data =
58 boost::shared_ptr< std::vector< float > >(
59 new std::vector< float >( &dataArray[0], &dataArray[0] +
sizeof( dataArray ) /
sizeof(
float ) ) );
60 boost::shared_ptr< WValueSetBase > newValueSet(
new WValueSet< float >( 1, 6, data, W_DT_FLOAT ) );
61 boost::shared_ptr< WGrid > newGrid(
new WGridRegular3D( 1, 1, 1 ) );
62 TS_ASSERT_THROWS_NOTHING(
WDataSetDTI( newValueSet, newGrid ) );
71 float dataArray[6] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 };
72 boost::shared_ptr< std::vector< float > > data =
73 boost::shared_ptr< std::vector< float > >(
74 new std::vector< float >( &dataArray[0], &dataArray[0] +
sizeof( dataArray ) /
sizeof(
float ) ) );
75 boost::shared_ptr< WValueSetBase > newValueSet(
new WValueSet< float >( 1, 6, data, W_DT_FLOAT ) );
76 boost::shared_ptr< WGrid > newGrid(
new WGridRegular3D( 1, 1, 1 ) );
79 expected( 0, 0 ) = 0.0;
80 expected( 0, 1 ) = 1.0;
81 expected( 0, 2 ) = 2.0;
82 expected( 1, 1 ) = 3.0;
83 expected( 1, 2 ) = 4.0;
84 expected( 2, 2 ) = 5.0;
85 TS_ASSERT_EQUALS( dataset.
getTensor( 0 ), expected );
89 #endif // WDATASETDTI_TEST_H
Implements a symmetric tensor that has the same number of components in every direction.
A grid that has parallelepiped cells which all have the same proportion.
WTensorSym< 2, 3, float > getTensor(size_t index) const
Retrieves the i'th tensor.
Testsuite for unit tests of the WDataSetDTI class.
static void startup(std::ostream &output=std::cout, LogLevel level=LL_DEBUG)
Create the first and only instance of the logger as it is a singleton.
void testInstanziation(void)
Only values sets of order 1, dim 6 should be used to construct DTI datasets.
Base Class for all value set types.
void setUp()
Setup logger and other stuff for each test.
Represents a Diffusion-Tensor-Image dataset.
void testTensorAccess(void)
Accessing the i'th tensor is: getting the WValue at that position and transform it to a WTensorSym< 2...