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