DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
itkMeanDiffusivityFromGHOTImageFilter.h
Go to the documentation of this file.
1 
18 #ifndef __itkMeanDiffusivityFromGHOTImageFilter_h
19 #define __itkMeanDiffusivityFromGHOTImageFilter_h
20 
21 #include "itkUnaryFunctorImageFilter.h"
22 #include "itkNumericTraits.h"
23 #include "utlCoreMacro.h"
24 
25 namespace itk
26 {
27 namespace Functor {
28 
36 template< class TInput, class TOutput>
38 {
39 public:
42  bool operator!=( const MeanDiffusivityFromGHOTCoefficients & other ) const
43  {
44  return !(*this == other);
45  }
46  bool operator==( const MeanDiffusivityFromGHOTCoefficients & other ) const
47  {
48  return other.m_Scale==m_Scale && other.m_Tau==m_Tau;
49  }
50 
51  inline TOutput operator()( const TInput & A ) const
52  {
53  TOutput output;
54  output = (A[0]/m_Scale) / (4*M_PI*M_PI*m_Tau) * (1.0/ (std::sqrt(4*M_PI)));
55  return output;
56  }
57  void SetScale(const double scale) {this->m_Scale = scale; }
58  const double & GetScale() const { return m_Scale; }
59  void SetTau(const double tau) {this->m_Tau = tau; }
60  const double & GetTau() const { return m_Tau; }
61 
62  double m_Scale;
63  double m_Tau;
64 };
65 }
66 
79 template <class TInputImage, class TOutputImage>
81  public
82 UnaryFunctorImageFilter<TInputImage,TOutputImage,
83  Functor::MeanDiffusivityFromGHOTCoefficients<
84  typename TInputImage::PixelType,
85  typename TOutputImage::PixelType> >
86 {
87 public:
90  typedef UnaryFunctorImageFilter<
91  TInputImage,TOutputImage,
93  typename TInputImage::PixelType,
94  typename TOutputImage::PixelType> > Superclass;
95 
96  typedef SmartPointer<Self> Pointer;
97  typedef SmartPointer<const Self> ConstPointer;
98 
100  itkNewMacro(Self);
101 
103  itkTypeMacro(MeanDiffusivityFromGHOTImageFilter, UnaryFunctorImageFilter);
104 
105  void SetScale(const double scale)
106  {
107  if( scale != this->GetFunctor().GetScale() )
108  {
109  this->GetFunctor().SetScale(scale);
110  this->Modified();
111  }
112  }
113  const double & GetScale() const
114  {
115  return this->GetFunctor().GetScale();
116  }
117 
118  void SetTau(const double tau)
119  {
120  if( tau != this->GetFunctor().GetTau() )
121  {
122  this->GetFunctor().SetTau(tau);
123  this->Modified();
124  }
125  }
126  const double & GetTau() const
127  {
128  return this->GetFunctor().GetTau();
129  }
130 
131 protected:
134 
135  void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
136  {
137  Superclass::PrintSelf(os, indent);
138  os << indent << "Scale = " << static_cast<double>(this->GetScale())
139  << ", Tau = " << static_cast<double>(this->GetTau())
140  << std::endl;
141  }
142 
143 private:
144  MeanDiffusivityFromGHOTImageFilter(const Self&); //purposely not implemented
145  void operator=(const Self&); //purposely not implemented
146 
147 };
148 
149 
150 
151 } // end namespace itk
152 
153 
154 #endif
bool operator!=(const MeanDiffusivityFromGHOTCoefficients &other) const
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::MeanDiffusivityFromGHOTCoefficients< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
#define ITK_OVERRIDE
Definition: utlITKMacro.h:46
bool operator==(const MeanDiffusivityFromGHOTCoefficients &other) const
#define M_PI
Definition: utlCoreMacro.h:57
#define ONE_OVER_4_PI_2
Definition: utlCoreMacro.h:63
Compute mean diffusivity from GHOT coefficients.
void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
macros for utlCore