14 #ifndef itkDiffusionTensor3DNearestCorrection_h 15 #define itkDiffusionTensor3DNearestCorrection_h 17 #include "itkUnaryFunctorImageFilter.h" 18 #include "vnl/vnl_math.h" 19 #include <itkMatrix.h> 43 template <
class TInput,
class TOutput>
51 return *
this != other;
56 return !( *
this != other );
59 inline DiffusionTensor3D<TOutput> operator()
60 (
const DiffusionTensor3D<TInput> & tensorA )
63 Matrix<double, 3, 3> B;
64 Matrix<double, 3, 3> A;
65 Matrix<double, 3, 3> transpose;
66 Matrix<double, 3, 3> H;
67 Matrix<double, 3, 3> mat;
69 transpose = A.GetTranspose();
70 B = (A + transpose) / 2;
71 transpose = B.GetTranspose();
77 tensorDouble.ComputeEigenAnalysis( eigenValues, eigenVectors );
78 for(
int i = 0; i < 3; i++ )
80 mat[i][i] = sqrt(eigenValues[i]);
82 eigenVectors = eigenVectors.GetTranspose();
83 H = eigenVectors * mat * eigenVectors.GetInverse();
86 tensorDouble.ComputeEigenAnalysis( eigenValues, eigenVectors );
89 for(
int i = 0; i < 3; i++ )
93 eigenVectors = eigenVectors.GetTranspose();
96 DiffusionTensor3D<TOutput> tensor;
97 for(
int i = 0; i < 6; i++ )
99 tensor[i] = ( TOutput ) tensorDouble[i];
107 template <
class TInputImage,
class TOutputImage>
110 UnaryFunctorImageFilter<TInputImage, TOutputImage,
111 Functor::DiffusionTensor3DNearest<
112 typename TInputImage::PixelType::ComponentType,
113 typename TOutputImage::PixelType::ComponentType> >
118 typedef UnaryFunctorImageFilter<TInputImage, TOutputImage,
134 #ifdef ITK_USE_CONCEPT_CHECKING 137 ( Concept::SameType<DiffusionTensor3D<typename TInputImage::PixelType::ComponentType>,
138 typename TInputImage::PixelType> ) );
140 ( Concept::SameType<DiffusionTensor3D<typename TOutputImage::PixelType::ComponentType>,
141 typename TOutputImage::PixelType> ) );
void operator=(const Self &)=delete
SmartPointer< const Self > ConstPointer
DiffusionTensor3DNearestCorrectionFilter()=default
void SetTensorFromMatrix(Matrix< C, 3, 3 > matrix)
bool operator!=(const DiffusionTensor3DNearest &other) const
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::DiffusionTensor3DNearest< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
Simplified inverse ITK transforms.
* itkConceptMacro(OutputEqualityComparableCheck, *(Concept::EqualityComparable< OutputImagePixelType >))
SmartPointer< Self > Pointer
DiffusionTensor3DNearestCorrectionFilter Self
itkTypeMacro(DiffusionTensor3DNearestCorrectionFilter, UnaryFunctorImageFilter)
#define ITK_DIFFUSION_TENSOR_3D_ZERO
~DiffusionTensor3DNearestCorrectionFilter() override=default
bool operator==(const DiffusionTensor3DNearest &other) const
DiffusionTensor3DNearest()=default
~DiffusionTensor3DNearest()=default
MatrixType GetTensor2Matrix()