DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
itkSHCoefficientsToGFAImageFilter.h
Go to the documentation of this file.
1 
11 #ifndef __itkSHCoefficientsToGFAImageFilter_h
12 #define __itkSHCoefficientsToGFAImageFilter_h
13 
14 #include "itkUnaryFunctorImageFilter.h"
15 #include <cmath>
16 
17 namespace itk
18 {
27 namespace Functor
28 {
29 template <class TInput, class TOutput=double>
31 {
32 public:
33 
35  {
36  }
37 
39  {
40  }
41 
42  bool operator!=(const SHCoefficientsToGFA & other) const
43  {
44  return !( *this == other );
45  }
46 
47  bool operator==(const SHCoefficientsToGFA & other) const
48  {
49  return false;
50  }
51 
52  inline TOutput operator()(const TInput & A)
53  {
54  double norm2 = A.GetSquaredNorm();
55  if (norm2>0)
56  return std::sqrt(1 - A[0]*A[0]/norm2 );
57  else
58  return 0;
59  }
60 
61 
62 };
63 }
64 
65 template <class TInputImage, class TOutputImage=itk::Image<double,3> >
67  public
68  UnaryFunctorImageFilter<TInputImage, TOutputImage,
69  Functor::SHCoefficientsToGFA<
70  typename TInputImage::PixelType,
71  typename TOutputImage::PixelType> >
72 {
73 public:
76  typedef UnaryFunctorImageFilter<
77  TInputImage, TOutputImage,
79  typename TInputImage::PixelType, typename TOutputImage::PixelType>
81 
82  typedef SmartPointer<Self> Pointer;
83  typedef SmartPointer<const Self> ConstPointer;
84 
86  itkNewMacro( Self );
87 
89  itkTypeMacro( SHCoefficientsToGFAImageFilter, UnaryFunctorImageFilter );
90 
91 protected:
93  {
94  }
95 
97  {
98  }
99 
100 private:
101  SHCoefficientsToGFAImageFilter(const Self &); // purposely not implemented
102  void operator=(const Self &); // purposely not implemented
103 };
104 } // end namespace itk
105 
106 
107 #endif
bool operator!=(const SHCoefficientsToGFA &other) const
In each vxoel, calculate gfa from SH coefficients.
bool operator==(const SHCoefficientsToGFA &other) const
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::SHCoefficientsToGFA< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass