ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkAnisotropicDiffusionFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkAnisotropicDiffusionFunction_h
19 #define __itkAnisotropicDiffusionFunction_h
20 
22 
23 namespace itk
24 {
137 template< class TImage >
139  public FiniteDifferenceFunction< TImage >
140 {
141 public:
142 
148 
151 
153  typedef typename Superclass::ImageType ImageType;
160 
162  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
163 
169  virtual void CalculateAverageGradientMagnitudeSquared(ImageType *) = 0;
170 
174  void SetTimeStep(const TimeStepType & t)
175  {
176  m_TimeStep = t;
177  }
178 
179  const TimeStepType & GetTimeStep() const
180  {
181  return m_TimeStep;
182  }
183 
185  void SetConductanceParameter(const double & c)
186  {
187  m_ConductanceParameter = c;
188  }
189 
190  const double & GetConductanceParameter() const
191  {
192  return m_ConductanceParameter;
193  }
194 
196  const double & GetAverageGradientMagnitudeSquared() const
197  {
198  return m_AverageGradientMagnitudeSquared;
199  }
200 
201  void SetAverageGradientMagnitudeSquared(const double & c)
202  {
203  m_AverageGradientMagnitudeSquared = c;
204  }
205 
208  virtual TimeStepType ComputeGlobalTimeStep( void *itkNotUsed(GlobalData) ) const
209  {
210  return this->GetTimeStep();
211  }
212 
215  virtual void * GetGlobalDataPointer() const
216  {
217  return 0;
218  }
219 
221  virtual void ReleaseGlobalDataPointer( void *itkNotUsed(GlobalData) ) const
222  {
223  /* do nothing */
224  }
225 
226 protected:
228  {
229  m_AverageGradientMagnitudeSquared = 0.0;
230  m_ConductanceParameter = 1.0; // default value
231  m_TimeStep = 0.125f; // default value
232  }
233 
235 
236  void PrintSelf(std::ostream & os, Indent indent) const
237  {
238  Superclass::PrintSelf(os, indent);
239  os << indent << "TimeStep: " << m_TimeStep << std::endl;
240  os << indent << "ConductanceParameter: " << m_ConductanceParameter
241  << std::endl;
242  }
243 
244 private:
245  AnisotropicDiffusionFunction(const Self &); //purposely not implemented
246  void operator=(const Self &); //purposely not implemented
247 
251 };
252 } // end namespace itk
253 
254 #endif
255