ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkNeighborhoodAccessorFunctor.h
Go to the documentation of this file.
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 __itkNeighborhoodAccessorFunctor_h
00019 #define __itkNeighborhoodAccessorFunctor_h
00020 
00021 #include "itkImageBoundaryCondition.h"
00022 #include "itkImageBase.h"
00023 
00024 namespace itk
00025 {
00040 template< class TImage >
00041 class NeighborhoodAccessorFunctor
00042 {
00043 public:
00044   typedef NeighborhoodAccessorFunctor           Self;
00045   typedef TImage                                ImageType;
00046   typedef typename ImageType::PixelType         PixelType;
00047   typedef typename ImageType::InternalPixelType InternalPixelType;
00048   typedef unsigned int                          VectorLengthType;
00049   typedef typename ImageType::OffsetType        OffsetType;
00050 
00051   itkStaticConstMacro(ImageDimension, unsigned int, TImage::ImageDimension);
00052 #if 0
00053   typedef Neighborhood< InternalPixelType *,
00054                         ::itk::GetImageDimension< TImage >::ImageDimension > NeighborhoodType;
00055 #else
00056   typedef Neighborhood< InternalPixelType *, Self::ImageDimension > NeighborhoodType;
00057 #endif
00058 
00059   typedef ImageBoundaryCondition< ImageType > const *
00060   ImageBoundaryConditionConstPointerType;
00061 
00063   inline void SetBegin(const InternalPixelType *) {}
00064 
00071   inline PixelType Get(const InternalPixelType *pixelPointer) const
00072   {
00073     return ( *pixelPointer );
00074   }
00075 
00077   inline void Set(InternalPixelType * & pixelPointer, const PixelType & p) const
00078   {
00079     *pixelPointer = p;
00080   }
00081 
00082   inline PixelType BoundaryCondition(
00083     const OffsetType & point_index,
00084     const OffsetType & boundary_offset,
00085     const NeighborhoodType *data,
00086     const ImageBoundaryConditionConstPointerType boundaryCondition) const
00087   {
00088     return boundaryCondition->operator()(point_index, boundary_offset, data);
00089   }
00090 
00091   void SetVectorLength(VectorLengthType) {}
00092   VectorLengthType SetVectorLength() { return 0; }
00093 
00095   NeighborhoodAccessorFunctor() {}
00096 
00098   virtual ~NeighborhoodAccessorFunctor() {}
00099 };
00100 } // end namespace itk
00101 
00102 //template< class TImage > const unsigned int
00103 // itk::NeighborhoodAccessorFunctor<TImage>::ImageDimension;
00104 
00105 #endif
00106