KWStyle - itkNeighborhoodAccessorFunctor.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkNeighborhoodAccessorFunctor.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:42 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 #ifndef __itkNeighborhoodAccessorFunctor_h
18 #define __itkNeighborhoodAccessorFunctor_h
19
20 #include "itkImageBoundaryCondition.h"
21 #include "itkNeighborhood.h"
22 #include "itkImageBase.h" 
23
24 namespace itk
25 {
26  
27 /** \class NeighborhoodAccessorFunctor
28  * \brief Provides accessor interfaces to Get pixels and is meant to be
29  * used on pointers contained within Neighborhoods. A typical user should
30  * not need to use this class directly. This class is used by the 
31  * neighborhood iterators to get pixels from pixel pointers or assign 
32  * a pixel to an address. 
33  *
34  * 
35  * \note
36  * This work is part of the National Alliance for Medical Image Computing 
37  * (NAMIC), funded by the National Institutes of Health through the NIH Roadmap
38  * for Medical Research, Grant U54 EB005149.
39 IND ***/
40 template< class TImage >
41 class NeighborhoodAccessorFunctor
42 {
43 public:
44   typedef TImage                                ImageType;
45   typedef typename ImageType::PixelType         PixelType;
46   typedef typename ImageType::InternalPixelType InternalPixelType;
47   typedef unsigned int                          VectorLengthType;
48   typedef typename ImageType::OffsetType        OffsetType;
49
50   typedef Neighborhood< InternalPixelType *,
51           ::itk::GetImageDimension< TImage >::ImageDimension > NeighborhoodType;
52   
53   typedef ImageBoundaryCondition< ImageType > const *
54 IND **************************ImageBoundaryConditionConstPointerType;
55   
56   /** Set the pointer index to the start of the buffer. */
57   inline void SetBegin( const InternalPixelType *) {}
58   
59   /** Method to dereference a pixel pointer. This is used from the 
60    * ConstNeighborhoodIterator as the equivalent operation to (*it).
61    * This method should be preferred over the former (*it) notation. 
62    * The reason is that dereferencing a pointer to a location of 
63    * VectorImage pixel involves a different operation that simply
64    * dereferencing the pointer.  */
65   inline PixelType Get( const InternalPixelType *pixelPointer ) const
66     { 
67     return (*pixelPointer);
68     }
69
70   /** Method to set the pixel value at a certain pixel pointer */
71   inline void Set( InternalPixelType* &pixelPointer, const PixelType &p ) const
72     {
73     *pixelPointer = p;
74     }
75   
76   inline PixelType BoundaryCondition( 
77       const OffsetType& point_index,
78       const OffsetType &boundary_offset, 
79       const NeighborhoodType *data,
80       const ImageBoundaryConditionConstPointerType boundaryCondition) const
81     {
82     return boundaryCondition->operator()(point_index, boundary_offset, data);
83     }
84   
85   void SetVectorLength( VectorLengthType length ) {};
86   VectorLengthType SetVectorLength() { return 0; };
87   
88 };
89
90 // end namespace itk
91 #endif
92

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:27PM
© Kitware Inc.