ITK  4.4.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 {
138 template< class TImage >
140  public FiniteDifferenceFunction< TImage >
141 {
142 public:
143 
149 
152 
154  typedef typename Superclass::ImageType ImageType;
161 
163  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
164 
170  virtual void CalculateAverageGradientMagnitudeSquared(ImageType *) = 0;
171 
175  void SetTimeStep(const TimeStepType & t)
176  {
177  m_TimeStep = t;
178  }
179 
180  const TimeStepType & GetTimeStep() const
181  {
182  return m_TimeStep;
183  }
184 
186  void SetConductanceParameter(const double & c)
187  {
188  m_ConductanceParameter = c;
189  }
190 
191  const double & GetConductanceParameter() const
192  {
193  return m_ConductanceParameter;
194  }
195 
197  const double & GetAverageGradientMagnitudeSquared() const
198  {
199  return m_AverageGradientMagnitudeSquared;
200  }
201 
202  void SetAverageGradientMagnitudeSquared(const double & c)
203  {
204  m_AverageGradientMagnitudeSquared = c;
205  }
206 
209  virtual TimeStepType ComputeGlobalTimeStep( void *itkNotUsed(GlobalData) ) const
210  {
211  return this->GetTimeStep();
212  }
213 
216  virtual void * GetGlobalDataPointer() const
217  {
218  return 0;
219  }
220 
222  virtual void ReleaseGlobalDataPointer( void *itkNotUsed(GlobalData) ) const
223  {
224  /* do nothing */
225  }
226 
227 protected:
229  {
230  m_AverageGradientMagnitudeSquared = 0.0;
231  m_ConductanceParameter = 1.0; // default value
232  m_TimeStep = 0.125f; // default value
233  }
234 
236 
237  void PrintSelf(std::ostream & os, Indent indent) const
238  {
239  Superclass::PrintSelf(os, indent);
240  os << indent << "TimeStep: " << m_TimeStep << std::endl;
241  os << indent << "ConductanceParameter: " << m_ConductanceParameter
242  << std::endl;
243  }
244 
245 private:
246  AnisotropicDiffusionFunction(const Self &); //purposely not implemented
247  void operator=(const Self &); //purposely not implemented
248 
252 };
253 } // end namespace itk
254 
255 #endif
256