Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
itkDiffusionTensor3DAbsCorrection.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Diffusion Applications
4 Module: $HeadURL$
5 Language: C++
6 Date: $Date$
7 Version: $Revision$
8
9 Copyright (c) Brigham and Women's Hospital (BWH) All Rights Reserved.
10
11 See License.txt or http://www.slicer.org/copyright/copyright.txt for details.
12
13==========================================================================*/
14#ifndef itkDiffusionTensor3DAbsCorrection_h
15#define itkDiffusionTensor3DAbsCorrection_h
16
17#include "itkUnaryFunctorImageFilter.h"
18#include "itkMath.h"
19#include <itkMatrix.h>
21
22namespace itk
23{
24
44namespace Functor
45{
46
47template <class TInput, class TOutput>
49{
50public:
53 bool operator!=(const DiffusionTensor3DAbs& other) const { return *this != other; }
54
55 bool operator==(const DiffusionTensor3DAbs& other) const { return !(*this != other); }
56
57 inline DiffusionTensor3D<TOutput> operator()(const DiffusionTensor3D<TInput>& A)
58 {
59 DiffusionTensor3D<TOutput> tensor;
60 Matrix<double, 3, 3> mat;
61 Matrix<double, 3, 3> matcorrect;
65 tensorDouble.ComputeEigenAnalysis(eigenValues, eigenVectors);
66 for (int i = 0; i < 3; i++)
67 {
68 mat[i][i] = (eigenValues[i] < 0 ? -eigenValues[i] : eigenValues[i]);
69 }
70 eigenVectors = eigenVectors.GetTranspose();
71 matcorrect = eigenVectors * mat * eigenVectors.GetInverse();
72 tensorDouble.SetTensorFromMatrix(matcorrect);
73 for (int i = 0; i < 6; i++)
74 {
75 tensor[i] = (TOutput)tensorDouble[i];
76 }
77 return tensor;
78 }
79};
80} // namespace Functor
81
82template <class TInputImage, class TOutputImage>
84 : public UnaryFunctorImageFilter<TInputImage,
85 TOutputImage,
86 Functor::DiffusionTensor3DAbs<typename TInputImage::PixelType::ComponentType, typename TOutputImage::PixelType::ComponentType>>
87{
88public:
91 typedef UnaryFunctorImageFilter<TInputImage, TOutputImage, Functor::DiffusionTensor3DAbs<typename TInputImage::PixelType, typename TOutputImage::PixelType>> Superclass;
92 typedef SmartPointer<Self> Pointer;
93 typedef SmartPointer<const Self> ConstPointer;
94
97 void operator=(const Self&) = delete;
98
101
104
105#ifdef ITK_USE_CONCEPT_CHECKING
107 itkConceptMacro(InputTensorTypeCheck, (Concept::SameType<DiffusionTensor3D<typename TInputImage::PixelType::ComponentType>, typename TInputImage::PixelType>));
108 itkConceptMacro(OutputTensorTypeCheck, (Concept::SameType<DiffusionTensor3D<typename TOutputImage::PixelType::ComponentType>, typename TOutputImage::PixelType>));
109
111#endif
112protected:
115};
116
117} // end namespace itk
118
119#endif
~DiffusionTensor3DAbsCorrectionFilter() override=default
void operator=(const Self &)=delete
DiffusionTensor3DAbsCorrectionFilter(const Self &)=delete
itkTypeMacro(DiffusionTensor3DAbsCorrectionFilter, UnaryFunctorImageFilter)
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::DiffusionTensor3DAbs< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
void SetTensorFromMatrix(Matrix< C, 3, 3 > matrix)
bool operator==(const DiffusionTensor3DAbs &other) const
bool operator!=(const DiffusionTensor3DAbs &other) const
DiffusionTensor3D< TOutput > operator()(const DiffusionTensor3D< TInput > &A)
Simplified inverse ITK transforms.