30 #include "WDataCreatorSingleDirection.h"
31 #include "core/common/WLogger.h"
32 #include "core/dataHandler/WDataHandlerEnums.h"
33 #include "core/dataHandler/WValueSet.h"
49 typedef double ValueType;
52 if( order != 1 || dimension != 3 )
54 return ValueSetType::SPtr();
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() );
64 for(
size_t x = 0; x < grid->getNbCoordsX(); ++x )
66 for(
size_t y = 0; y < grid->getNbCoordsY(); ++y )
68 for(
size_t z = 0; z < grid->getNbCoordsZ(); ++z )
70 data->operator[]( ( valuesPerVoxel * grid->getVoxelNum( x, y, z ) ) + 0 ) = dir[ 0 ];
71 data->operator[]( ( valuesPerVoxel * grid->getVoxelNum( x, y, z ) ) + 1 ) = dir[ 1 ];
72 data->operator[]( ( valuesPerVoxel * grid->getVoxelNum( x, y, z ) ) + 2 ) = dir[ 2 ];
75 progress->increment( grid->getNbCoordsZ() );
79 return ValueSetType::SPtr(
new ValueSetType( order, dimension, data ) );
WDataCreatorSingleDirection()
Default constructor.
virtual ~WDataCreatorSingleDirection()
Destructor.
WPropPosition m_vector
The vector to copy to the voxels.
virtual WValueSetBase::SPtr operator()(WProgress::SPtr progress, WGridRegular3D::ConstSPtr grid, unsigned char order=1, unsigned char dimension=3, 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.
This only is a 3d double vector.
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...