ITK
4.1.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 __itkFiniteDifferenceFunction_h 00019 #define __itkFiniteDifferenceFunction_h 00020 00021 #include "itkLightObject.h" 00022 #include "itkConstNeighborhoodIterator.h" 00023 #include "itkVector.h" 00024 00025 namespace itk 00026 { 00065 template< class TImageType > 00066 class ITK_EXPORT FiniteDifferenceFunction:public LightObject 00067 { 00068 public: 00069 00071 typedef FiniteDifferenceFunction Self; 00072 typedef LightObject Superclass; 00073 typedef SmartPointer< Self > Pointer; 00074 typedef SmartPointer< const Self > ConstPointer; 00075 00077 itkTypeMacro(FiniteDifferenceFunction, LightObject); 00078 00080 typedef TImageType ImageType; 00081 typedef typename ImageType::PixelType PixelType; 00082 typedef double PixelRealType; 00083 00085 itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension); 00086 00088 typedef double TimeStepType; 00089 00092 typedef ZeroFluxNeumannBoundaryCondition< ImageType > 00093 DefaultBoundaryConditionType; 00094 00096 typedef typename ConstNeighborhoodIterator< TImageType >::RadiusType RadiusType; 00097 00100 typedef ConstNeighborhoodIterator< TImageType, DefaultBoundaryConditionType > NeighborhoodType; 00101 00104 typedef Vector< PixelRealType, itkGetStaticConstMacro(ImageDimension) > NeighborhoodScalesType; 00105 00108 typedef Vector< float, itkGetStaticConstMacro(ImageDimension) > FloatOffsetType; 00109 00119 virtual void InitializeIteration() {} 00120 00134 #if !defined( CABLE_CONFIGURATION ) 00135 virtual PixelType ComputeUpdate( const NeighborhoodType & neighborhood, 00136 void *globalData, 00137 const FloatOffsetType & offset = FloatOffsetType(0.0) ) = 0; 00138 00139 #endif 00140 00143 void SetRadius(const RadiusType & r); 00144 00147 const RadiusType & GetRadius() const; 00148 00152 void SetScaleCoefficients(PixelRealType vals[ImageDimension]); 00153 00157 const NeighborhoodScalesType ComputeNeighborhoodScales() const; 00158 00165 virtual TimeStepType ComputeGlobalTimeStep(void *GlobalData) const = 0; 00166 00174 virtual void * GetGlobalDataPointer() const = 0; 00175 00181 virtual void ReleaseGlobalDataPointer(void *GlobalData) const = 0; 00182 00183 protected: 00184 FiniteDifferenceFunction(); 00185 ~FiniteDifferenceFunction() {} 00186 00187 void PrintSelf(std::ostream & os, Indent indent) const; 00188 00189 RadiusType m_Radius; 00190 PixelRealType m_ScaleCoefficients[ImageDimension]; 00191 private: 00192 FiniteDifferenceFunction(const Self &); //purposely not implemented 00193 void operator=(const Self &); //purposely not implemented 00194 }; 00195 } // end namespace itk 00196 00197 // Define instantiation macro for this template. 00198 #define ITK_TEMPLATE_FiniteDifferenceFunction(_, EXPORT, TypeX, TypeY) \ 00199 namespace itk \ 00200 { \ 00201 _( 1 ( class EXPORT FiniteDifferenceFunction< ITK_TEMPLATE_1 TypeX > ) ) \ 00202 namespace Templates \ 00203 { \ 00204 typedef FiniteDifferenceFunction< ITK_TEMPLATE_1 TypeX > FiniteDifferenceFunction##TypeY; \ 00205 } \ 00206 } 00207 00208 #if ITK_TEMPLATE_EXPLICIT 00209 #include "Templates/itkFiniteDifferenceFunction+-.h" 00210 #endif 00211 00212 #if ITK_TEMPLATE_TXX 00213 #include "itkFiniteDifferenceFunction.hxx" 00214 #endif 00215 00216 #endif 00217