00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkNeighborhoodAccessorFunctor.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-04-21 15:46:16 $ 00007 Version: $Revision: 1.3 $ 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 __itkNeighborhoodAccessorFunctor_h 00018 #define __itkNeighborhoodAccessorFunctor_h 00019 00020 #include "itkImageBoundaryCondition.h" 00021 #include "itkNeighborhood.h" 00022 #include "itkImageBase.h" 00023 00024 namespace itk 00025 { 00026 00040 template< class TImage > 00041 class NeighborhoodAccessorFunctor 00042 { 00043 public: 00044 typedef TImage ImageType; 00045 typedef typename ImageType::PixelType PixelType; 00046 typedef typename ImageType::InternalPixelType InternalPixelType; 00047 typedef unsigned int VectorLengthType; 00048 typedef typename ImageType::OffsetType OffsetType; 00049 00050 typedef Neighborhood< InternalPixelType *, 00051 ::itk::GetImageDimension< TImage >::ImageDimension > NeighborhoodType; 00052 00053 typedef ImageBoundaryCondition< ImageType > const * 00054 ImageBoundaryConditionConstPointerType; 00055 00057 inline void SetBegin( const InternalPixelType *) {} 00058 00065 inline PixelType Get( const InternalPixelType *pixelPointer ) const 00066 { 00067 return (*pixelPointer); 00068 } 00069 00071 inline void Set( InternalPixelType* &pixelPointer, const PixelType &p ) const 00072 { 00073 *pixelPointer = p; 00074 } 00075 00076 inline PixelType BoundaryCondition( 00077 const OffsetType& point_index, 00078 const OffsetType &boundary_offset, 00079 const NeighborhoodType *data, 00080 const ImageBoundaryConditionConstPointerType boundaryCondition) const 00081 { 00082 return boundaryCondition->operator()(point_index, boundary_offset, data); 00083 } 00084 00085 void SetVectorLength( VectorLengthType length ) {} 00086 VectorLengthType SetVectorLength() { return 0; } 00087 00089 NeighborhoodAccessorFunctor() {} 00090 00092 virtual ~NeighborhoodAccessorFunctor() {} 00093 00094 }; 00095 00096 } // end namespace itk 00097 #endif 00098