00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkConstantBoundaryCondition.h,v $ 00005 Language: C++ 00006 Date: $Date: 2006/04/20 16:59:33 $ 00007 Version: $Revision: 1.19 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef __itkConstantBoundaryCondition_h 00018 #define __itkConstantBoundaryCondition_h 00019 #include "itkNeighborhood.h" 00020 #include "itkNumericTraits.h" 00021 #include "itkImageBoundaryCondition.h" 00022 00023 namespace itk 00024 { 00025 00059 template<class TImage> 00060 class ITK_EXPORT ConstantBoundaryCondition 00061 : public ImageBoundaryCondition<TImage> 00062 { 00063 public: 00065 typedef ConstantBoundaryCondition Self; 00066 typedef ImageBoundaryCondition<TImage> Superclass; 00067 00069 typedef typename Superclass::PixelType PixelType; 00070 typedef typename Superclass::PixelPointerType PixelPointerType; 00071 typedef typename Superclass::IndexType IndexType; 00072 typedef typename Superclass::OffsetType OffsetType; 00073 typedef typename Superclass::NeighborhoodType NeighborhoodType; 00074 00075 typedef typename Superclass::NeighborhoodAccessorFunctorType 00076 NeighborhoodAccessorFunctorType; 00077 00079 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension); 00080 00082 ConstantBoundaryCondition() 00083 { m_Constant = NumericTraits<PixelType>::Zero; } 00084 00087 virtual PixelType operator()(const OffsetType&, 00088 const OffsetType&, 00089 const NeighborhoodType *) const 00090 { return m_Constant; } 00091 00094 virtual PixelType operator()( 00095 const OffsetType& , 00096 const OffsetType& , 00097 const NeighborhoodType *, 00098 const NeighborhoodAccessorFunctorType & ) const 00099 { return m_Constant; } 00100 00102 void SetConstant(const PixelType &c) 00103 { m_Constant = c; } 00104 00106 const PixelType &GetConstant() const 00107 { return m_Constant; } 00108 00112 bool RequiresCompleteNeighborhood() { return false; } 00113 00114 private: 00115 PixelType m_Constant; 00116 }; 00117 00118 } // end namespace itk 00119 00120 #endif 00121