25 #ifndef WITKIMAGECONVERSION_TEST_H
26 #define WITKIMAGECONVERSION_TEST_H
31 #include <boost/shared_ptr.hpp>
34 #include <cxxtest/TestSuite.h>
36 #include "../../common/WLogger.h"
37 #include "../WITKImageConversion.h"
61 boost::shared_ptr< std::vector< int > > values(
new std::vector< int >( 27, 0 ) );
62 for(
int k = 0; k < 27; ++k )
64 ( *values )[ k ] = 27 - k;
66 boost::shared_ptr< WGridRegular3D > g(
new WGridRegular3D( 3, 3, 3 ) );
67 boost::shared_ptr< WValueSet< int > > v(
new WValueSet< int >( 0, 1, values, W_DT_SIGNED_INT ) );
68 boost::shared_ptr< WDataSetScalar > ds(
new WDataSetScalar( v, g ) );
70 itk::Image< int, 3 >::Pointer i = makeImageFromDataSet< int >( ds );
71 boost::shared_ptr< WDataSetScalar > newds = makeDataSetFromImage< int >( i );
73 TS_ASSERT_SAME_DATA( boost::dynamic_pointer_cast<
WValueSet< int > >( ds->getValueSet() )->rawData(),
74 boost::dynamic_pointer_cast<
WValueSet< int > >( newds->getValueSet() )->rawData(),
sizeof( int ) * 27 );
79 #endif // WITKIMAGECONVERSION_TEST_H
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.
Test functionality of WITKConversion class.
Base Class for all value set types.
void setUp()
Setup logger and other stuff for each test.
This data set type contains scalars as values.
void testConversion()
Converting a dataset into an itk image and then converting it back into a dataset should yield the sa...