DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
itkSPFScaleFromMeanDiffusivityImageFilter.h
Go to the documentation of this file.
1 
18 #ifndef __itkSPFScaleFromMeanDiffusivityImageFilter_h
19 #define __itkSPFScaleFromMeanDiffusivityImageFilter_h
20 
21 
22 
23 #include "itkUnaryFunctorImageFilter.h"
24 #include "itkNumericTraits.h"
25 
26 namespace itk
27 {
40 namespace Functor {
41 
42 template< class TInput, class TOutput>
44 {
45 public:
48  bool operator!=( const SPFScaleFromMeanDiffusivity & other ) const
49  {
50  return !(*this == other);
51  }
52  bool operator==( const SPFScaleFromMeanDiffusivity & other ) const
53  {
54  return other.m_MD0==m_MD0 || other.m_Tau==m_Tau;
55  }
56 
57  inline TOutput operator()( const TInput & A ) const
58  {
59  if (A<1e-10)
60  return 0.0;
65  TOutput scale;
67  scale = 1.0 / (8*M_PI*M_PI*this->m_Tau* (A>this->m_MD0*0.01? A : this->m_MD0) ) ; // 714.29 (700) scale for SPF basis, dual scale is 1/(4*pi^2*scale)
68  else
69  scale = 2*this->m_Tau*(A>this->m_MD0*0.01? A : this->m_MD0); // 3.5462e-5 scale for SPF basis, dual scale is 1/(4*pi^2*scale)
70  return scale;
71  }
72  void SetMD0(const double md0) {this->m_MD0 = md0; }
73  const double & GetMD0() const { return m_MD0; }
74  void SetTau(const double tau) {this->m_Tau = tau; }
75  const double & GetTau() const { return m_Tau; }
76  void SetIsOriginalBasis(const bool isSPF) {this->m_IsOriginalBasis = isSPF; }
77  const bool & GetIsOriginalBasis() const { return m_IsOriginalBasis; }
78 
79  double m_MD0;
80  double m_Tau;
82 };
83 }
84 
85 template <class TInputImage, class TOutputImage>
87  public
88 UnaryFunctorImageFilter<TInputImage,TOutputImage,
89  Functor::SPFScaleFromMeanDiffusivity<
90  typename TInputImage::PixelType,
91  typename TOutputImage::PixelType> >
92 {
93 public:
96  typedef UnaryFunctorImageFilter<
97  TInputImage,TOutputImage,
99  typename TInputImage::PixelType,
100  typename TOutputImage::PixelType> > Superclass;
101 
102  typedef SmartPointer<Self> Pointer;
103  typedef SmartPointer<const Self> ConstPointer;
104 
106  itkNewMacro(Self);
107 
109  itkTypeMacro(SPFScaleFromMeanDiffusivityImageFilter, UnaryFunctorImageFilter);
110 
111  void SetMD0(const double md0)
112  {
113  if( md0 != this->GetFunctor().GetMD0() )
114  {
115  this->GetFunctor().SetMD0(md0);
116  this->Modified();
117  }
118  }
119  const double & GetMD0() const
120  {
121  return this->GetFunctor().GetMD0();
122  }
123 
124  void SetTau(const double tau)
125  {
126  if( tau != this->GetFunctor().GetTau() )
127  {
128  this->GetFunctor().SetTau(tau);
129  this->Modified();
130  }
131  }
132  const double & GetTau() const
133  {
134  return this->GetFunctor().GetTau();
135  }
136 
137  void SetIsOriginalBasis(const bool isSPF)
138  {
139  if( isSPF != this->GetFunctor().GetIsOriginalBasis() )
140  {
141  this->GetFunctor().SetIsOriginalBasis(isSPF);
142  this->Modified();
143  }
144  }
145  const bool & GetIsOriginalBasis() const
146  {
147  return this->GetFunctor().GetIsOriginalBasis();
148  }
149 
150 protected:
153 
154  void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
155  {
156  Superclass::PrintSelf(os, indent);
157  os << indent << "md0 = " << static_cast<double>(this->GetMD0())
158  << ", Tau = " << static_cast<double>(this->GetTau())
159  << std::endl;
160  }
161 
162 private:
163  SPFScaleFromMeanDiffusivityImageFilter(const Self&); //purposely not implemented
164  void operator=(const Self&); //purposely not implemented
165 
166 };
167 
168 
169 
170 } // end namespace itk
171 
172 
173 
174 #endif
bool operator==(const SPFScaleFromMeanDiffusivity &other) const
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::SPFScaleFromMeanDiffusivity< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
#define ITK_OVERRIDE
Definition: utlITKMacro.h:46
#define M_PI
Definition: utlCoreMacro.h:57
#define ONE_OVER_4_PI_2
Definition: utlCoreMacro.h:63
void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
bool operator!=(const SPFScaleFromMeanDiffusivity &other) const