30 #include "WDataCreatorRandom.h"
31 #include "core/common/WLogger.h"
32 #include "core/dataHandler/WDataHandlerEnums.h"
33 #include "core/dataHandler/WValueSet.h"
50 std::srand( time( 0 ) );
53 typedef double ValueType;
57 std::shared_ptr< std::vector< ValueType > > data(
new std::vector< ValueType > );
59 size_t valuesPerVoxel = ValueSetType::getRequiredRawSizePerVoxel( order, dimension );
60 data->resize( valuesPerVoxel * grid->size() );
63 for(
size_t x = 0; x < grid->getNbCoordsX(); ++x )
65 for(
size_t y = 0; y < grid->getNbCoordsY(); ++y )
67 for(
size_t z = 0; z < grid->getNbCoordsZ(); ++z )
70 for(
size_t v = 0; v < valuesPerVoxel; ++v )
73 double randD =
static_cast< double >( std::rand() ) /
static_cast< double >( RAND_MAX );
74 data->operator[]( ( valuesPerVoxel * grid->getVoxelNum( x, y, z ) ) + v ) =
80 progress->increment( grid->getNbCoordsZ() );
86 return ValueSetType::SPtr(
new ValueSetType( order, dimension , data ) );
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.
WPropDouble m_rangeMax
Maximum value in the dataset.
WDataCreatorRandom()
Default constructor.
virtual ~WDataCreatorRandom()
Destructor.
WPropDouble m_rangeMin
Minimum value in 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...