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>
55 return *
this != other;
60 return !( *
this != other );
63 inline DiffusionTensor3D<TOutput> operator()
64 (
const DiffusionTensor3D<TInput> & tensorA )
67 Matrix<double, 3, 3> B;
68 Matrix<double, 3, 3> A;
69 Matrix<double, 3, 3> transpose;
70 Matrix<double, 3, 3> H;
71 Matrix<double, 3, 3> mat;
73 transpose = A.GetTranspose();
74 B = (A + transpose) / 2;
75 transpose = B.GetTranspose();
81 tensorDouble.ComputeEigenAnalysis( eigenValues, eigenVectors );
82 for(
int i = 0; i < 3; i++ )
84 mat[i][i] = sqrt(eigenValues[i]);
86 eigenVectors = eigenVectors.GetTranspose();
87 H = eigenVectors * mat * eigenVectors.GetInverse();
90 tensorDouble.ComputeEigenAnalysis( eigenValues, eigenVectors );
93 for(
int i = 0; i < 3; i++ )
97 eigenVectors = eigenVectors.GetTranspose();
100 DiffusionTensor3D<TOutput> tensor;
101 for(
int i = 0; i < 6; i++ )
103 tensor[i] = ( TOutput ) tensorDouble[i];
111 template <
class TInputImage,
class TOutputImage>
114 UnaryFunctorImageFilter<TInputImage, TOutputImage,
115 Functor::DiffusionTensor3DNearest<
116 typename TInputImage::PixelType::ComponentType,
117 typename TOutputImage::PixelType::ComponentType> >
122 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> ) );
154 void operator=(
const Self & );
SmartPointer< const Self > ConstPointer
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()
DiffusionTensor3DNearestCorrectionFilter Self
itkTypeMacro(DiffusionTensor3DNearestCorrectionFilter, UnaryFunctorImageFilter)
~DiffusionTensor3DNearest()
virtual ~DiffusionTensor3DNearestCorrectionFilter()
#define ITK_DIFFUSION_TENSOR_3D_ZERO
bool operator==(const DiffusionTensor3DNearest &other) const
MatrixType GetTensor2Matrix()
DiffusionTensor3DNearest()