OpenWalnut  1.5.0dev
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
WSymmetricSphericalHarmonic< T > Class Template Reference

Class for symmetric spherical harmonics The index scheme of the coefficients/basis values is like in the Descoteaux paper "Regularized, Fast, and Robust Analytical Q-Ball Imaging". More...

#include <WSymmetricSphericalHarmonic.h>

+ Collaboration diagram for WSymmetricSphericalHarmonic< T >:

Public Member Functions

 WSymmetricSphericalHarmonic ()
 Default constructor. More...
 
 WSymmetricSphericalHarmonic (const WValue< T > &SHCoefficients)
 Constructor. More...
 
virtual ~WSymmetricSphericalHarmonic ()
 Destructor. More...
 
getValue (T theta, T phi) const
 Return the value on the sphere. More...
 
getValue (const WUnitSphereCoordinates< T > &coordinates) const
 Return the value on the sphere. More...
 
const WValue< T > & getCoefficients () const
 Returns the used coefficients (stored like in the mentioned 2007 Descoteaux paper). More...
 
WValue< T > getCoefficientsSchultz () const
 Returns the coefficients for Schultz' SH base. More...
 
WValue< std::complex< T > > getCoefficientsComplex () const
 Returns the coefficients for the complex base. More...
 
void setFromComplex (WValue< std::complex< T > > const &coeffs, int order)
 Set the coeffs from complex base coeffs. More...
 
void applyFunkRadonTransformation (WMatrix< T > const &frtMat)
 Applies the Funk-Radon-Transformation. More...
 
size_t getOrder () const
 Return the order of the spherical harmonic. More...
 
calcGFA (std::vector< WUnitSphereCoordinates< T > > const &orientations) const
 Calculate the generalized fractional anisotropy for this ODF. More...
 
calcGFA (WMatrix< T > const &B) const
 Calculate the generalized fractional anisotropy for this ODF. More...
 
void normalize ()
 Normalize this SH in place. More...
 

Static Public Member Functions

static WMatrix< T > getSHFittingMatrix (const std::vector< WMatrixFixed< T, 3, 1 > > &orientations, int order, T lambda, bool withFRT)
 This calculates the transformation/fitting matrix T like in the 2007 Descoteaux paper. More...
 
static WMatrix< T > getSHFittingMatrix (const std::vector< WUnitSphereCoordinates< T > > &orientations, int order, T lambda, bool withFRT)
 This calculates the transformation/fitting matrix T like in the 2007 Descoteaux paper. More...
 
static WMatrix< T > getSHFittingMatrixForConstantSolidAngle (const std::vector< WMatrixFixed< T, 3, 1 > > &orientations, int order, T lambda)
 This calculates the transformation/fitting matrix T like in the 2010 Aganj paper. More...
 
static WMatrix< T > getSHFittingMatrixForConstantSolidAngle (const std::vector< WUnitSphereCoordinates< T > > &orientations, int order, T lambda)
 This calculates the transformation/fitting matrix T like in the 2010 Aganj paper. More...
 
static WMatrix< T > calcBaseMatrix (const std::vector< WUnitSphereCoordinates< T > > &orientations, int order)
 Calculates the base matrix B like in the dissertation of Descoteaux. More...
 
static WMatrix< std::complex< T > > calcComplexBaseMatrix (std::vector< WUnitSphereCoordinates< T > > const &orientations, int order)
 Calculates the base matrix B for the complex spherical harmonics. More...
 
static WValue< T > calcEigenvalues (size_t order)
 Calc eigenvalues for SH elements. More...
 
static WMatrix< T > calcMatrixWithEigenvalues (size_t order)
 Calc matrix with the eigenvalues of the SH elements on its diagonal. More...
 
static WMatrix< T > calcSmoothingMatrix (size_t order)
 This calcs the smoothing matrix L from the 2007 Descoteaux Paper "Regularized, Fast, and Robust Analytical Q-Ball Imaging". More...
 
static WMatrix< T > calcFRTMatrix (size_t order)
 Calculates the Funk-Radon-Transformation-Matrix P from the 2007 Descoteaux Paper "Regularized, Fast, and Robust Analytical Q-Ball Imaging". More...
 
static WMatrix< T > calcSHToTensorSymMatrix (std::size_t order)
 Calculates a matrix that converts spherical harmonics to symmetric tensors of equal or lower order. More...
 
static WMatrix< T > calcSHToTensorSymMatrix (std::size_t order, const std::vector< WUnitSphereCoordinates< T > > &orientations)
 Calculates a matrix that converts spherical harmonics to symmetric tensors of equal or lower order. More...
 

Private Attributes

size_t m_order
 order of the spherical harmonic More...
 
WValue< T > m_SHCoefficients
 coefficients of the spherical harmonic More...
 

Detailed Description

template<typename T>
class WSymmetricSphericalHarmonic< T >

Class for symmetric spherical harmonics The index scheme of the coefficients/basis values is like in the Descoteaux paper "Regularized, Fast, and Robust Analytical Q-Ball Imaging".

Definition at line 51 of file WSymmetricSphericalHarmonic.h.

Constructor & Destructor Documentation

◆ WSymmetricSphericalHarmonic() [1/2]

Default constructor.

Definition at line 287 of file WSymmetricSphericalHarmonic.h.

◆ WSymmetricSphericalHarmonic() [2/2]

template<typename T >
WSymmetricSphericalHarmonic< T >::WSymmetricSphericalHarmonic ( const WValue< T > &  SHCoefficients)
explicit

Constructor.

Parameters
SHCoefficientsthe initial coefficients (stored like in the mentioned Descoteaux paper).

Definition at line 294 of file WSymmetricSphericalHarmonic.h.

References WSymmetricSphericalHarmonic< T >::m_order, and WSymmetricSphericalHarmonic< T >::m_SHCoefficients.

◆ ~WSymmetricSphericalHarmonic()

template<typename T >
WSymmetricSphericalHarmonic< T >::~WSymmetricSphericalHarmonic
virtual

Destructor.

Definition at line 304 of file WSymmetricSphericalHarmonic.h.

Member Function Documentation

◆ applyFunkRadonTransformation()

template<typename T >
void WSymmetricSphericalHarmonic< T >::applyFunkRadonTransformation ( WMatrix< T > const &  frtMat)

Applies the Funk-Radon-Transformation.

This is faster than matrix multiplication. ( O(n) instead of O(n²) )

Parameters
frtMatthe frt matrix as calculated by calcFRTMatrix()

Definition at line 546 of file WSymmetricSphericalHarmonic.h.

References WMatrix< T >::getNbCols(), and WMatrix< T >::getNbRows().

+ Here is the call graph for this function:

◆ calcBaseMatrix()

template<typename T >
WMatrix< T > WSymmetricSphericalHarmonic< T >::calcBaseMatrix ( const std::vector< WUnitSphereCoordinates< T > > &  orientations,
int  order 
)
static

Calculates the base matrix B like in the dissertation of Descoteaux.

Parameters
orientationsThe vector with the used orientation on the unit sphere (usually the gradients of the HARDI)
orderThe order of the spherical harmonics intended to create
Returns
The base Matrix B

Definition at line 656 of file WSymmetricSphericalHarmonic.h.

Referenced by WMCalculateGFA::moduleMain().

+ Here is the caller graph for this function:

◆ calcComplexBaseMatrix()

template<typename T >
WMatrix< std::complex< T > > WSymmetricSphericalHarmonic< T >::calcComplexBaseMatrix ( std::vector< WUnitSphereCoordinates< T > > const &  orientations,
int  order 
)
static

Calculates the base matrix B for the complex spherical harmonics.

Parameters
orientationsThe vector with the used orientation on the unit sphere (usually the gradients of the HARDI)
orderThe order of the spherical harmonics intended to create
Returns
The base Matrix B

Definition at line 692 of file WSymmetricSphericalHarmonic.h.

◆ calcEigenvalues()

template<typename T >
WValue< T > WSymmetricSphericalHarmonic< T >::calcEigenvalues ( size_t  order)
static

Calc eigenvalues for SH elements.

Parameters
orderThe order of the spherical harmonic
Returns
The eigenvalues of the coefficients

Definition at line 722 of file WSymmetricSphericalHarmonic.h.

◆ calcFRTMatrix()

template<typename T >
WMatrix< T > WSymmetricSphericalHarmonic< T >::calcFRTMatrix ( size_t  order)
static

Calculates the Funk-Radon-Transformation-Matrix P from the 2007 Descoteaux Paper "Regularized, Fast, and Robust Analytical Q-Ball Imaging".

Parameters
orderThe order of the spherical harmonic
Returns
The Funk-Radon-Matrix P

Definition at line 763 of file WSymmetricSphericalHarmonic.h.

◆ calcGFA() [1/2]

template<typename T >
T WSymmetricSphericalHarmonic< T >::calcGFA ( std::vector< WUnitSphereCoordinates< T > > const &  orientations) const

Calculate the generalized fractional anisotropy for this ODF.

See: David S. Tuch, "Q-Ball Imaging", Magn. Reson. Med. 52, 2004, 1358-1372

Note
this only makes sense if this is an ODF, meaning funk-radon-transform was applied etc.
Parameters
orientationsA vector of unit sphere coordinates.
Returns
The generalized fractional anisotropy.

Definition at line 450 of file WSymmetricSphericalHarmonic.h.

Referenced by WMCalculateGFA::perVoxelGFAFunc().

+ Here is the caller graph for this function:

◆ calcGFA() [2/2]

template<typename T >
T WSymmetricSphericalHarmonic< T >::calcGFA ( WMatrix< T > const &  B) const

Calculate the generalized fractional anisotropy for this ODF.

This version of the function uses precomputed base functions (because calculating the base function values is rather expensive). Use this version if you want to compute the GFA for multiple ODFs with the same base functions. The base function Matrix can be computed using

See also
calcBMatrix().

See: David S. Tuch, "Q-Ball Imaging", Magn. Reson. Med. 52, 2004, 1358-1372

Note
this only makes sense if this is an ODF, meaning funk-radon-transform was applied etc.
Parameters
BThe matrix of SH base functions.
Returns
The generalized fractional anisotropy.

Definition at line 494 of file WSymmetricSphericalHarmonic.h.

References WMatrix< T >::getNbCols(), and WMatrix< T >::getNbRows().

+ Here is the call graph for this function:

◆ calcMatrixWithEigenvalues()

template<typename T >
WMatrix< T > WSymmetricSphericalHarmonic< T >::calcMatrixWithEigenvalues ( size_t  order)
static

Calc matrix with the eigenvalues of the SH elements on its diagonal.

Parameters
orderThe order of the spherical harmonic
Returns
The matrix with the eigenvalues of the coefficients

Definition at line 739 of file WSymmetricSphericalHarmonic.h.

References WValue< T >::size().

+ Here is the call graph for this function:

◆ calcSHToTensorSymMatrix() [1/2]

template<typename T >
WMatrix< T > WSymmetricSphericalHarmonic< T >::calcSHToTensorSymMatrix ( std::size_t  order)
static

Calculates a matrix that converts spherical harmonics to symmetric tensors of equal or lower order.

Parameters
orderThe order of the symmetric tensor.
Returns
the conversion matrix

Definition at line 782 of file WSymmetricSphericalHarmonic.h.

Referenced by WMCalculateTensors::moduleMain().

+ Here is the caller graph for this function:

◆ calcSHToTensorSymMatrix() [2/2]

template<typename T >
WMatrix< T > WSymmetricSphericalHarmonic< T >::calcSHToTensorSymMatrix ( std::size_t  order,
const std::vector< WUnitSphereCoordinates< T > > &  orientations 
)
static

Calculates a matrix that converts spherical harmonics to symmetric tensors of equal or lower order.

Parameters
orderThe order of the symmetric tensor.
orientationsA vector of at least (orderTensor+1) * (orderTensor+2) / 2 orientations.
Returns
the conversion matrix

Definition at line 802 of file WSymmetricSphericalHarmonic.h.

◆ calcSmoothingMatrix()

template<typename T >
WMatrix< T > WSymmetricSphericalHarmonic< T >::calcSmoothingMatrix ( size_t  order)
static

This calcs the smoothing matrix L from the 2007 Descoteaux Paper "Regularized, Fast, and Robust Analytical Q-Ball Imaging".

Parameters
orderThe order of the spherical harmonic
Returns
The smoothing matrix L

Definition at line 751 of file WSymmetricSphericalHarmonic.h.

References WValue< T >::size().

+ Here is the call graph for this function:

◆ getCoefficients()

template<typename T >
const WValue< T > & WSymmetricSphericalHarmonic< T >::getCoefficients

Returns the used coefficients (stored like in the mentioned 2007 Descoteaux paper).

Returns
coefficient list

Definition at line 342 of file WSymmetricSphericalHarmonic.h.

◆ getCoefficientsComplex()

template<typename T >
WValue< std::complex< T > > WSymmetricSphericalHarmonic< T >::getCoefficientsComplex

Returns the coefficients for the complex base.

Returns
coefficiend list

Definition at line 372 of file WSymmetricSphericalHarmonic.h.

◆ getCoefficientsSchultz()

template<typename T >
WValue< T > WSymmetricSphericalHarmonic< T >::getCoefficientsSchultz

Returns the coefficients for Schultz' SH base.

Returns
coefficient list

Definition at line 348 of file WSymmetricSphericalHarmonic.h.

◆ getOrder()

template<typename T >
size_t WSymmetricSphericalHarmonic< T >::getOrder

Return the order of the spherical harmonic.

Returns
order of SH

Definition at line 558 of file WSymmetricSphericalHarmonic.h.

◆ getSHFittingMatrix() [1/2]

template<typename T >
WMatrix< T > WSymmetricSphericalHarmonic< T >::getSHFittingMatrix ( const std::vector< WMatrixFixed< T, 3, 1 > > &  orientations,
int  order,
lambda,
bool  withFRT 
)
static

This calculates the transformation/fitting matrix T like in the 2007 Descoteaux paper.

The orientations are given as WMatrixFixed< T, 3, 1 >.

Parameters
orientationsThe vector with the used orientation on the unit sphere (usually the gradients of the HARDI)
orderThe order of the spherical harmonics intended to create
lambdaRegularization parameter for smoothing matrix
withFRTinclude the Funk-Radon-Transformation?
Returns
Transformation matrix

Definition at line 564 of file WSymmetricSphericalHarmonic.h.

◆ getSHFittingMatrix() [2/2]

template<typename T >
WMatrix< T > WSymmetricSphericalHarmonic< T >::getSHFittingMatrix ( const std::vector< WUnitSphereCoordinates< T > > &  orientations,
int  order,
lambda,
bool  withFRT 
)
static

This calculates the transformation/fitting matrix T like in the 2007 Descoteaux paper.

The orientations are given as WUnitSphereCoordinates< T >.

Parameters
orientationsThe vector with the used orientation on the unit sphere (usually the gradients of the HARDI)
orderThe order of the spherical harmonics intended to create
lambdaRegularization parameter for smoothing matrix
withFRTinclude the Funk-Radon-Transformation?
Returns
Transformation matrix

Definition at line 579 of file WSymmetricSphericalHarmonic.h.

References WMatrix< T >::transposed().

+ Here is the call graph for this function:

◆ getSHFittingMatrixForConstantSolidAngle() [1/2]

template<typename T >
WMatrix< T > WSymmetricSphericalHarmonic< T >::getSHFittingMatrixForConstantSolidAngle ( const std::vector< WMatrixFixed< T, 3, 1 > > &  orientations,
int  order,
lambda 
)
static

This calculates the transformation/fitting matrix T like in the 2010 Aganj paper.

The orientations are given as WUnitSphereCoordinates< T >.

Parameters
orientationsThe vector with the used orientation on the unit sphere (usually the gradients of the HARDI)
orderThe order of the spherical harmonics intended to create
lambdaRegularization parameter for smoothing matrix
Returns
Transformation matrix

Definition at line 603 of file WSymmetricSphericalHarmonic.h.

Referenced by WMHARDIToSphericalHarmonics::moduleMain().

+ Here is the caller graph for this function:

◆ getSHFittingMatrixForConstantSolidAngle() [2/2]

template<typename T >
WMatrix< T > WSymmetricSphericalHarmonic< T >::getSHFittingMatrixForConstantSolidAngle ( const std::vector< WUnitSphereCoordinates< T > > &  orientations,
int  order,
lambda 
)
static

This calculates the transformation/fitting matrix T like in the 2010 Aganj paper.

The orientations are given as WUnitSphereCoordinates< T >.

Parameters
orientationsThe vector with the used orientation on the unit sphere (usually the gradients of the HARDI)
orderThe order of the spherical harmonics intended to create
lambdaRegularization parameter for smoothing matrix
Returns
Transformation matrix

Definition at line 617 of file WSymmetricSphericalHarmonic.h.

References wlog::debug(), and WMatrix< T >::transposed().

+ Here is the call graph for this function:

◆ getValue() [1/2]

template<typename T >
T WSymmetricSphericalHarmonic< T >::getValue ( const WUnitSphereCoordinates< T > &  coordinates) const

Return the value on the sphere.

Parameters
coordinatesfor the position on the unit sphere
Returns
value on sphere

Definition at line 336 of file WSymmetricSphericalHarmonic.h.

References WUnitSphereCoordinates< T >::getPhi(), and WUnitSphereCoordinates< T >::getTheta().

+ Here is the call graph for this function:

◆ getValue() [2/2]

template<typename T >
T WSymmetricSphericalHarmonic< T >::getValue ( theta,
phi 
) const

Return the value on the sphere.

Parameters
thetaangle for the position on the unit sphere
phiangle for the position on the unit sphere
Returns
value on sphere

Definition at line 309 of file WSymmetricSphericalHarmonic.h.

Referenced by WSphericalHarmonicsCoefficientsThread< T >::threadMain().

+ Here is the caller graph for this function:

◆ normalize()

template<typename T >
void WSymmetricSphericalHarmonic< T >::normalize

Normalize this SH in place.

Definition at line 857 of file WSymmetricSphericalHarmonic.h.

◆ setFromComplex()

template<typename T >
void WSymmetricSphericalHarmonic< T >::setFromComplex ( WValue< std::complex< T > > const &  coeffs,
int  order 
)

Set the coeffs from complex base coeffs.

Parameters
coeffsThe complex coefficients, sorted by order, then phase, ascending.
orderThe order of the spherical harmonic.

Definition at line 403 of file WSymmetricSphericalHarmonic.h.

Member Data Documentation

◆ m_order

template<typename T >
size_t WSymmetricSphericalHarmonic< T >::m_order
private

order of the spherical harmonic

Definition at line 280 of file WSymmetricSphericalHarmonic.h.

Referenced by WSymmetricSphericalHarmonic< T >::WSymmetricSphericalHarmonic().

◆ m_SHCoefficients

template<typename T >
WValue< T > WSymmetricSphericalHarmonic< T >::m_SHCoefficients
private

coefficients of the spherical harmonic

Definition at line 283 of file WSymmetricSphericalHarmonic.h.

Referenced by WSymmetricSphericalHarmonic< T >::WSymmetricSphericalHarmonic().


The documentation for this class was generated from the following file: