| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkImageBoundaryCondition.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:36 $ |
| 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 |
DEF |
#ifndef __itkImageBoundaryCondition_h_ |
| 18 |
DEF |
#define __itkImageBoundaryCondition_h_ |
| 19 |
|
|
| 20 |
|
#include "itkIndex.h" |
| 21 |
|
#include "itkOffset.h" |
| 22 |
|
#include "itkNeighborhood.h" |
| 23 |
|
|
| 24 |
|
namespace itk |
| 25 |
|
{ |
| 26 |
|
|
| 27 |
|
/** |
| 28 |
|
*\class ImageBoundaryCondition |
| 29 |
|
* \brief A virtual base object that defines an interface to a class of |
| 30 |
|
* boundary condition objects for use by neighborhood iterators. |
| 31 |
|
* |
| 32 |
|
* A boundary condition object supplies a phantom pixel value when |
| 33 |
|
* given a neighborhood of (pointers to) image values, the (ND) index of |
| 34 |
|
* the phantom pixel, and its (ND) offset from the boundary. The index |
| 35 |
|
* of the phantom pixel is relative to the "upper left-hand corner" of |
| 36 |
|
* the neighborhood (as opposed to its center). |
| 37 |
|
* |
| 38 |
|
* |
| 39 |
|
* Associated Types Description |
| 40 |
|
* ---------------- ----------- |
| 41 |
|
* PixelType The data type of the return value. |
| 42 |
|
* PixelPointerType A pointer to PixelType. |
| 43 |
|
* PixelPointerTypeNeighborhood A neighborhood of PixelPointerTypes |
| 44 |
|
* that points to the pixel values in |
| 45 |
|
* an image neighborhood. |
| 46 |
|
* |
| 47 |
|
* \ingroup DataRepresentation |
| 48 |
|
* \ingroup ImageObjects |
| 49 |
|
*/ |
| 50 |
|
template <class TImageType> |
| 51 |
|
class ITK_EXPORT ImageBoundaryCondition |
| 52 |
|
{ |
| 53 |
|
public: |
| 54 |
|
/** Extract information from the image type */ |
| 55 |
|
itkStaticConstMacro(ImageDimension, unsigned int, |
| 56 |
|
TImageType::ImageDimension); |
| 57 |
|
|
| 58 |
|
/** Standard typedefs. */ |
| 59 |
|
typedef ImageBoundaryCondition Self; |
| 60 |
|
|
| 61 |
|
/** Extract information from the image type */ |
| 62 |
|
typedef typename TImageType::PixelType PixelType; |
| 63 |
TDA |
typedef typename TImageType::InternalPixelType *PixelPointerType; |
| 64 |
TDA |
typedef Index<itkGetStaticConstMacro(ImageDimension)> IndexType; |
| 65 |
TDA |
typedef Offset<itkGetStaticConstMacro(ImageDimension)> OffsetType; |
| 66 |
|
|
| 67 |
|
/** Type of the data container passed to this function object. */ |
| 68 |
|
typedef Neighborhood<PixelPointerType, |
| 69 |
|
itkGetStaticConstMacro(ImageDimension)> NeighborhoodType; |
| 70 |
|
|
| 71 |
|
/** Functor used to access pixels from a neighborhood of pixel pointers */ |
| 72 |
|
typedef typename TImageType::NeighborhoodAccessorFunctorType |
| 73 |
IND |
*********************************NeighborhoodAccessorFunctorType; |
| 74 |
|
|
| 75 |
|
/** Default constructor. */ |
| 76 |
|
ImageBoundaryCondition() {} |
| 77 |
|
|
| 78 |
|
/** Returns a value for a given out-of-bounds pixel. The arguments are the |
| 79 |
|
* phantom pixel (ND) index within the neighborhood, the pixel's offset from |
| 80 |
|
* the nearest image border pixel, and a neighborhood of pointers to pixel |
| 81 |
|
* values in the image. */ |
| 82 |
|
virtual PixelType operator()(const OffsetType& point_index, |
| 83 |
|
const OffsetType &boundary_offset, |
| 84 |
|
const NeighborhoodType *data) const = 0; |
| 85 |
|
|
| 86 |
|
/** Computes and returns the appropriate pixel value from |
| 87 |
|
* neighborhood iterator data, using the functor. */ |
| 88 |
|
virtual PixelType operator()( |
| 89 |
|
const OffsetType& point_index, |
| 90 |
|
const OffsetType& boundary_offset, |
| 91 |
|
const NeighborhoodType *data, |
| 92 |
LEN |
const NeighborhoodAccessorFunctorType &neighborhoodAccessorFunctor) const = 0; |
| 93 |
|
|
| 94 |
|
virtual ~ImageBoundaryCondition() {} |
| 95 |
|
}; |
| 96 |
|
|
| 97 |
|
}// end namespace itk |
| 98 |
|
|
| 99 |
|
|
| 100 |
|
#endif |
| 101 |
|
|