ITK
4.0.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkAnisotropicDiffusionFunction_h 00019 #define __itkAnisotropicDiffusionFunction_h 00020 00021 #include "itkFiniteDifferenceFunction.h" 00022 00023 namespace itk 00024 { 00136 template< class TImage > 00137 class ITK_EXPORT AnisotropicDiffusionFunction: 00138 public FiniteDifferenceFunction< TImage > 00139 { 00140 public: 00141 00143 typedef AnisotropicDiffusionFunction Self; 00144 typedef FiniteDifferenceFunction< TImage > Superclass; 00145 typedef SmartPointer< Self > Pointer; 00146 typedef SmartPointer< const Self > ConstPointer; 00147 00149 itkTypeMacro(AnisotropicDiffusionFunction, FiniteDifferenceFunction); 00150 00152 typedef typename Superclass::ImageType ImageType; 00153 typedef typename Superclass::PixelType PixelType; 00154 typedef typename Superclass::PixelRealType PixelrealType; 00155 typedef typename Superclass::RadiusType RadiusType; 00156 typedef typename Superclass::NeighborhoodType NeighborhoodType; 00157 typedef typename Superclass::TimeStepType TimeStepType; 00158 typedef typename Superclass::FloatOffsetType FloatOffsetType; 00159 00161 itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension); 00162 00168 virtual void CalculateAverageGradientMagnitudeSquared(ImageType *) = 0; 00169 00173 void SetTimeStep(const TimeStepType & t) 00174 { 00175 m_TimeStep = t; 00176 } 00177 00178 const TimeStepType & GetTimeStep() const 00179 { 00180 return m_TimeStep; 00181 } 00182 00184 void SetConductanceParameter(const double & c) 00185 { 00186 m_ConductanceParameter = c; 00187 } 00188 00189 const double & GetConductanceParameter() const 00190 { 00191 return m_ConductanceParameter; 00192 } 00193 00195 const double & GetAverageGradientMagnitudeSquared() const 00196 { 00197 return m_AverageGradientMagnitudeSquared; 00198 } 00199 00200 void SetAverageGradientMagnitudeSquared(const double & c) 00201 { 00202 m_AverageGradientMagnitudeSquared = c; 00203 } 00204 00207 virtual TimeStepType ComputeGlobalTimeStep( void *itkNotUsed(GlobalData) ) const 00208 { 00209 return this->GetTimeStep(); 00210 } 00211 00214 virtual void * GetGlobalDataPointer() const 00215 { 00216 return 0; 00217 } 00218 00220 virtual void ReleaseGlobalDataPointer( void *itkNotUsed(GlobalData) ) const 00221 { 00222 /* do nothing */ 00223 } 00224 00225 protected: 00226 AnisotropicDiffusionFunction() 00227 { 00228 m_AverageGradientMagnitudeSquared = 0.0; 00229 m_ConductanceParameter = 1.0; // default value 00230 m_TimeStep = 0.125f; // default value 00231 } 00232 00233 ~AnisotropicDiffusionFunction() {} 00234 00235 void PrintSelf(std::ostream & os, Indent indent) const 00236 { 00237 Superclass::PrintSelf(os, indent); 00238 os << indent << "TimeStep: " << m_TimeStep << std::endl; 00239 os << indent << "ConductanceParameter: " << m_ConductanceParameter 00240 << std::endl; 00241 } 00242 00243 private: 00244 AnisotropicDiffusionFunction(const Self &); //purposely not implemented 00245 void operator=(const Self &); //purposely not implemented 00246 00247 double m_AverageGradientMagnitudeSquared; 00248 double m_ConductanceParameter; 00249 TimeStepType m_TimeStep; 00250 }; 00251 } // end namespace itk 00252 00253 #endif 00254