16 #include <vnl/vnl_cross.h>
17 #include <vnl/vnl_quaternion.h>
22 template<
class ScalarType >
33 template<
class ScalarType >
39 template<
class ScalarType >
44 if (dir>=this->m_GradientList.size())
48 this->m_FiberDirection.Normalize();
49 vnl_vector_fixed<double, 3> axis = itk::CrossProduct(m_KernelDirection, this->m_FiberDirection).GetVnlVector(); axis.normalize();
50 vnl_quaternion<double>
rotation(axis, acos(m_KernelDirection*this->m_FiberDirection));
52 vnl_matrix_fixed<double, 3, 3> matrix = rotation.rotation_matrix_transpose();
54 vnl_matrix_fixed<double, 3, 3> tensorMatrix = matrix.transpose()*m_KernelTensorMatrix*matrix;
55 tensor[0] = tensorMatrix[0][0]; tensor[1] = tensorMatrix[0][1]; tensor[2] = tensorMatrix[0][2];
56 tensor[3] = tensorMatrix[1][1]; tensor[4] = tensorMatrix[1][2]; tensor[5] = tensorMatrix[2][2];
63 itk::DiffusionTensor3D< ScalarType > S;
71 ScalarType D = tensor[0]*S[0] + tensor[1]*S[1] + tensor[2]*S[2] +
72 tensor[1]*S[1] + tensor[3]*S[3] + tensor[4]*S[4] +
73 tensor[2]*S[2] + tensor[4]*S[4] + tensor[5]*S[5];
77 signal = std::exp ( -m_BValue * bVal * D );
85 template<
class ScalarType >
88 PixelType signal; signal.SetSize(this->m_GradientList.size()); signal.Fill(0.0);
91 this->m_FiberDirection.Normalize();
92 vnl_vector_fixed<double, 3> axis = itk::CrossProduct(m_KernelDirection, this->m_FiberDirection).GetVnlVector(); axis.normalize();
93 vnl_quaternion<double>
rotation(axis, acos(m_KernelDirection*this->m_FiberDirection));
95 vnl_matrix_fixed<double, 3, 3> matrix = rotation.rotation_matrix_transpose();
97 vnl_matrix_fixed<double, 3, 3> tensorMatrix = matrix.transpose()*m_KernelTensorMatrix*matrix;
98 tensor[0] = tensorMatrix[0][0]; tensor[1] = tensorMatrix[0][1]; tensor[2] = tensorMatrix[0][2];
99 tensor[3] = tensorMatrix[1][1]; tensor[4] = tensorMatrix[1][2]; tensor[5] = tensorMatrix[2][2];
101 for(
unsigned int i=0; i<this->m_GradientList.size(); i++)
108 itk::DiffusionTensor3D< ScalarType > S;
116 ScalarType D = tensor[0]*S[0] + tensor[1]*S[1] + tensor[2]*S[2] +
117 tensor[1]*S[1] + tensor[3]*S[3] + tensor[4]*S[4] +
118 tensor[2]*S[2] + tensor[4]*S[4] + tensor[5]*S[5];
122 signal[i] = std::exp ( -m_BValue * bVal * D );
vnl_matrix_fixed< double, 3, 3 > m_KernelTensorMatrix
3x3 matrix containing the kernel tensor values
DataCollection - Class to facilitate loading/accessing structured data.
itk::Vector< double, 3 > GradientType
GradientType m_KernelDirection
Direction of the kernel tensors principal eigenvector.
PixelType SimulateMeasurement()
itk::DiffusionTensor3D< ScalarType > ItkTensorType