Commit 819abadb authored by Mathias Goldau's avatar Mathias Goldau
Browse files

[CHANGE] Now the WDataSetRawHARDI is able to store multiple b-values, which...

[CHANGE] Now the WDataSetRawHARDI is able to store multiple b-values, which may be differently for each non-zero gradient
parent bfaad4b0
......@@ -33,11 +33,9 @@
// prototype instance as singleton
boost::shared_ptr< WPrototyped > WDataSetRawHARDI::m_prototype = boost::shared_ptr< WPrototyped >();
WDataSetRawHARDI::WDataSetRawHARDI( boost::shared_ptr< WValueSetBase > newValueSet,
boost::shared_ptr< WGrid > newGrid,
boost::shared_ptr< std::vector< WVector3d > > newGradients,
double diffusionBValue )
: WDataSetSingle( newValueSet, newGrid ), m_gradients( newGradients ), m_diffusionBValue( diffusionBValue )
void WDataSetRawHARDI::init( boost::shared_ptr< WValueSetBase > newValueSet,
boost::shared_ptr< WGrid > newGrid,
boost::shared_ptr< std::vector< WVector3d > > newGradients )
{
WAssert( newValueSet, "No value set given." );
WAssert( newGrid, "No grid given." );
......@@ -47,6 +45,25 @@ WDataSetRawHARDI::WDataSetRawHARDI( boost::shared_ptr< WValueSetBase > newValueS
buildGradientIndexes();
}
WDataSetRawHARDI::WDataSetRawHARDI( boost::shared_ptr< WValueSetBase > newValueSet,
boost::shared_ptr< WGrid > newGrid,
boost::shared_ptr< std::vector< WVector3d > > newGradients,
double diffusionBValue )
: WDataSetSingle( newValueSet, newGrid ), m_gradients( newGradients ), m_diffusionBValues( new std::vector< float >( 1, diffusionBValue ) )
{
init( newValueSet, newGrid, newGradients );
}
WDataSetRawHARDI::WDataSetRawHARDI( boost::shared_ptr< WValueSetBase > newValueSet,
boost::shared_ptr< WGrid > newGrid,
boost::shared_ptr< std::vector< WVector3d > > newGradients,
boost::shared_ptr< std::vector< float > > diffusionBValues )
: WDataSetSingle( newValueSet, newGrid ), m_gradients( newGradients ), m_diffusionBValues( diffusionBValues )
{
WAssert( diffusionBValues, "No b-values given." );
init( newValueSet, newGrid, newGradients );
}
void WDataSetRawHARDI::buildGradientIndexes()
{
std::vector< size_t > validIndices;
......@@ -75,22 +92,22 @@ WDataSetRawHARDI::~WDataSetRawHARDI()
WDataSetSingle::SPtr WDataSetRawHARDI::clone( boost::shared_ptr< WValueSetBase > newValueSet, boost::shared_ptr< WGrid > newGrid ) const
{
return WDataSetSingle::SPtr( new WDataSetRawHARDI( newValueSet, newGrid, m_gradients, m_diffusionBValue ) );
return WDataSetSingle::SPtr( new WDataSetRawHARDI( newValueSet, newGrid, m_gradients, getDiffusionBValues() ) );
}
WDataSetSingle::SPtr WDataSetRawHARDI::clone( boost::shared_ptr< WValueSetBase > newValueSet ) const
{
return WDataSetSingle::SPtr( new WDataSetRawHARDI( newValueSet, getGrid(), m_gradients, getDiffusionBValue() ) );
return WDataSetSingle::SPtr( new WDataSetRawHARDI( newValueSet, getGrid(), m_gradients, getDiffusionBValues() ) );
}
WDataSetSingle::SPtr WDataSetRawHARDI::clone( boost::shared_ptr< WGrid > newGrid ) const
{
return WDataSetSingle::SPtr( new WDataSetRawHARDI( getValueSet(), newGrid, m_gradients, getDiffusionBValue() ) );
return WDataSetSingle::SPtr( new WDataSetRawHARDI( getValueSet(), newGrid, m_gradients, getDiffusionBValues() ) );
}
WDataSetSingle::SPtr WDataSetRawHARDI::clone() const
{
return WDataSetSingle::SPtr( new WDataSetRawHARDI( getValueSet(), getGrid(), m_gradients, getDiffusionBValue() ) );
return WDataSetSingle::SPtr( new WDataSetRawHARDI( getValueSet(), getGrid(), m_gradients, getDiffusionBValues() ) );
}
boost::shared_ptr< WPrototyped > WDataSetRawHARDI::getPrototype()
......@@ -112,14 +129,20 @@ const WVector3d& WDataSetRawHARDI::getGradient( size_t index ) const
#endif
}
std::vector< WVector3d > const& WDataSetRawHARDI::getOrientations() const
boost::shared_ptr< std::vector< WVector3d > > WDataSetRawHARDI::getOrientations() const
{
return *m_gradients;
return m_gradients;
}
double WDataSetRawHARDI::getDiffusionBValue() const
{
return m_diffusionBValue;
WAssert( ( *m_diffusionBValues ).size() == 1, "There is more then one diffusion b-value!" );
return ( *m_diffusionBValues )[ 0 ];
}
boost::shared_ptr< std::vector< float > > WDataSetRawHARDI::getDiffusionBValues() const
{
return m_diffusionBValues;
}
std::size_t WDataSetRawHARDI::getNumberOfMeasurements() const
......
......@@ -55,6 +55,22 @@ public:
boost::shared_ptr< std::vector< WVector3d > > newGradients,
double diffusionBValue = 1.0 );
/**
* Constructs an instance out of:
* - an appropriate value set with a vector of measure values for each voxel,
* - a grid and
* - the gradients used during the measurement of the different values.
*
* \param newValueSet the vector value set to use
* \param newGrid the grid which maps world space to the value set
* \param newGradients the Gradients of the
* \param diffusionBValues Strength of the gradient for every gradient
*/
WDataSetRawHARDI( boost::shared_ptr< WValueSetBase > newValueSet,
boost::shared_ptr< WGrid > newGrid,
boost::shared_ptr< std::vector< WVector3d > > newGradients,
boost::shared_ptr< std::vector< float > > diffusionBValues );
/**
* Construct an empty and unusable instance. This is needed for the prototype mechanism.
*/
......@@ -66,15 +82,16 @@ public:
virtual ~WDataSetRawHARDI();
/**
* Creates a copy (clone) of this instance but allows one to change the valueset. Unlike copy construction, this is a very useful function if you
* want to keep the dynamic type of your dataset.
*
* \param newValueSet the new valueset.
* \param newGrid the new grid.
*
* \return the clone
*/
virtual WDataSetSingle::SPtr clone( boost::shared_ptr< WValueSetBase > newValueSet, boost::shared_ptr< WGrid > newGrid ) const;
* Creates a copy (clone) of this instance but allows one to change the valueset. Unlike copy construction, this is a very useful function if you
* want to keep the dynamic type of your dataset.
*
* \param newValueSet the new valueset.
* \param newGrid the new grid.
*
* \return the clone
*/
virtual WDataSetSingle::SPtr clone( boost::shared_ptr< WValueSetBase > newValueSet, boost::shared_ptr< WGrid > newGrid ) const;
/**
* Creates a copy (clone) of this instance but allows one to change the valueset. Unlike copy construction, this is a very useful function if you
......@@ -146,7 +163,7 @@ public:
*
* \return A vector of orientations.
*/
std::vector< WVector3d > const& getOrientations() const;
boost::shared_ptr< std::vector< WVector3d > > getOrientations() const;
/**
* Get the indexes of zero gradients.
......@@ -178,6 +195,13 @@ public:
*/
double getDiffusionBValue() const;
/**
* Returns the \e b-values of the diffusion if there are different values.
*
* \return a vector of b-values
*/
boost::shared_ptr< std::vector< float > > getDiffusionBValues() const;
protected:
/**
* The prototype as singleton.
......@@ -185,16 +209,28 @@ protected:
static boost::shared_ptr< WPrototyped > m_prototype;
private:
/**
* Makes only such initialization which is common to all contructors.
*
* \param newValueSet The value set
* \param newGrid The grid
* \param newGradients The gradients
*/
void init( boost::shared_ptr< WValueSetBase > newValueSet,
boost::shared_ptr< WGrid > newGrid,
boost::shared_ptr< std::vector< WVector3d > > newGradients );
/**
* Build indexes for the zero and non-zero gradients.
*/
void buildGradientIndexes();
boost::shared_ptr< std::vector< WVector3d > > m_gradients; //!< Gradients of measurements
/**
* Strength (b-value) of the so-called magnetic diffusion gradient.
* Strength (b-value) of the so-called magnetic diffusion gradient. The vector contains only
* one value, incase all gradients (except b0 images) share the same b-value.
*/
double m_diffusionBValue;
boost::shared_ptr< std::vector< float > > m_diffusionBValues;
/**
* The indexes for the which gradient is zero.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment