28 #include "WDataCreatorBreyzel5.h"
29 #include "core/common/WAssert.h"
49 WAssert( ( order == 0 ) && ( dimension == 1 ),
"The data creator only supports scalar data." );
52 typedef double ValueType;
56 std::shared_ptr< std::vector< ValueType > > data(
new std::vector< ValueType > );
58 data->resize( grid->size() );
65 for(
size_t x = 0; x < grid->getNbCoordsX(); ++x )
67 xRel =
static_cast< double >( x ) /
static_cast< double >( grid->getNbCoordsX() - 1 );
71 for(
size_t y = 0; y < grid->getNbCoordsY(); ++y )
73 yRel =
static_cast< double >( y ) /
static_cast< double >( grid->getNbCoordsY() - 1 );
77 for(
size_t z = 0; z < grid->getNbCoordsZ(); ++z )
79 zRel =
static_cast< double >( z ) /
static_cast< double >( grid->getNbCoordsZ() - 1 );
83 double x2 = xRel * xRel;
84 double y2 = yRel * yRel;
85 double z2 = zRel * zRel;
86 double s = ( x2 + 0.25 * y2 - 1.0 ) * ( 0.25 * x2 + y2 - 1.0 );
87 data->operator[]( grid->getVoxelNum( x, y, z ) ) =
static_cast< ValueType
>( s * s + z2 - 0.1 );
91 progress->increment( grid->getNbCoordsZ() );
97 return ValueSetType::SPtr(
new ValueSetType( 0, 1, data ) );
WPropDouble m_scale
Scale the value domain.
virtual ~WDataCreatorBreyzel5()
Destructor.
WDataCreatorBreyzel5()
Default constructor.
virtual WValueSetBase::SPtr operator()(WProgress::SPtr progress, WGridRegular3D::ConstSPtr grid, unsigned char order=0, unsigned char dimension=1, dataType type=W_DT_FLOAT)
Create the dataset.
Define the interface which is injected into an WObjectNDIP.
std::shared_ptr< const WGridRegular3DTemplate > ConstSPtr
Convenience typedef for a std::shared_ptr< const WGridRegular3DTemplate >.
This is a base class for everything which has a Name,Description,Icon and Properties (=NDIP).
WProperties::SPtr m_properties
the properties of the object.
std::shared_ptr< WProgress > SPtr
Shared pointer on a WProgress.
std::shared_ptr< WValueSetBase > SPtr
Shared pointer to an instance of this class.
Base Class for all value set types.
dataType
Data types and number values taken from the nifti1.h, at this point it's unknown if it makes sense to...