9 template <
typename TImageType,
typename TInterpolatorPrecisionType>
14 if (!this->GetFiniteStrainReorientation())
15 itkExceptionMacro(
"ODF resampling only supports finite strain re-orientation");
17 this->Superclass::BeforeThreadedGenerateData();
19 unsigned int vectorSize = this->GetInput(0)->GetNumberOfComponentsPerPixel();
20 m_LOrder = (
unsigned int)floor((-3 + sqrt(8*vectorSize + 1))/2);
22 m_EulerAngles.resize(this->GetNumberOfWorkUnits());
23 m_ODFRotationMatrices.resize(this->GetNumberOfWorkUnits());
25 for (
unsigned int i = 0;i < this->GetNumberOfWorkUnits();++i)
26 m_EulerAngles[i].resize(3);
29 template <
typename TImageType,
typename TInterpolatorPrecisionType>
36 rotatedModel = interpolatedModel;
38 for (
unsigned int l = 2;l <= m_LOrder;l += 2)
41 m_EulerAngles[threadId][1],m_EulerAngles[threadId][2]);
43 unsigned int mBaseInd = (l*l + l + 2)/2 - l - 1;
45 for (
unsigned int m = 0;m <= 2*l;++m)
47 rotatedModel[mBaseInd + m] = 0;
48 for (
unsigned int mp = 0;mp <= 2*l;++mp)
49 rotatedModel[mBaseInd + m] += m_ODFRotationMatrices[threadId](m,mp)*interpolatedModel[mBaseInd + mp];
virtual void BeforeThreadedGenerateData() ITK_OVERRIDE
Superclass::InputPixelType InputPixelType
virtual void ReorientInterpolatedModel(const InputPixelType &interpolatedModel, vnl_matrix< double > &modelOrientationMatrix, InputPixelType &rotatedModel, itk::ThreadIdType threadId) ITK_OVERRIDE
Needs to be implemented in sub-classes, does the actual re-orientation of the model.
void GetEulerAnglesFromRotationMatrix(vnl_matrix< double > &R, std::vector< double > &resVal)
void EstimateLocalODFRotationMatrix(vnl_matrix< double > &resVal, unsigned int l, double alpha, double beta, double gamma)