| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkZeroFluxNeumannBoundaryCondition.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:49 $ |
| 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 __itkZeroFluxNeumannBoundaryCondition_h |
| 18 |
|
#define __itkZeroFluxNeumannBoundaryCondition_h |
| 19 |
|
#include "itkNeighborhood.h" |
| 20 |
|
#include "itkImageBoundaryCondition.h" |
| 21 |
|
|
| 22 |
|
namespace itk |
| 23 |
|
{ |
| 24 |
|
|
| 25 |
|
/** \class ZeroFluxNeumannBoundaryCondition |
| 26 |
|
* \brief |
| 27 |
|
* A function object that determines a neighborhood of values at an |
| 28 |
|
* image boundary according to a Neumann boundary condition where first, |
| 29 |
|
* upwind derivatives on the boundary are zero. This is a useful condition |
| 30 |
|
* in solving some classes of differential equations. |
| 31 |
|
* |
| 32 |
|
* For example, invoking this function object on a 7x5 iterator that masks |
| 33 |
|
* a region at an image corner (iterator is centered on the 2): |
| 34 |
|
* |
| 35 |
|
* * * * * * * * |
| 36 |
|
* * * * * * * * |
| 37 |
|
* * * 1 2 3 4 5 (where * denotes pixels that lie |
| 38 |
|
* * * 3 3 5 5 6 outside of the image boundary) |
| 39 |
|
* * * 4 4 6 7 8 |
| 40 |
|
* |
| 41 |
|
* returns the following neighborhood of values: |
| 42 |
|
* |
| 43 |
|
* 1 1 1 2 3 4 5 |
| 44 |
|
* 1 1 1 2 3 4 5 |
| 45 |
|
* 1 1 1 2 3 4 5 |
| 46 |
|
* 3 3 3 3 5 5 6 (note the corner values) |
| 47 |
|
* 4 4 4 4 6 7 8 |
| 48 |
|
* |
| 49 |
|
* The input to this function object is a neighborhood iterator. This boundary |
| 50 |
|
* condition object is designed to be given as a template argument to a |
| 51 |
|
* NeighborhoodIterator or any of the NeighborhoodIterator |
| 52 |
|
* subclasses. |
| 53 |
|
* |
| 54 |
|
* \ingroup DataRepresentation |
| 55 |
|
* \ingroup ImageObjects |
| 56 |
|
*/ |
| 57 |
|
template<class TImage> |
| 58 |
|
class ITK_EXPORT ZeroFluxNeumannBoundaryCondition |
| 59 |
IND |
**: public ImageBoundaryCondition<TImage> |
| 60 |
|
{ |
| 61 |
|
public: |
| 62 |
|
/** Standard class typedefs. */ |
| 63 |
|
typedef ZeroFluxNeumannBoundaryCondition Self; |
| 64 |
TDA |
typedef ImageBoundaryCondition<TImage> Superclass; |
| 65 |
|
|
| 66 |
|
/** Extract information from the image type. */ |
| 67 |
|
typedef typename Superclass::PixelType PixelType; |
| 68 |
TDA |
typedef typename Superclass::PixelPointerType PixelPointerType; |
| 69 |
|
typedef typename Superclass::IndexType IndexType; |
| 70 |
TDA |
typedef typename Superclass::OffsetType OffsetType; |
| 71 |
TDA |
typedef typename Superclass::NeighborhoodType NeighborhoodType; |
| 72 |
|
|
| 73 |
|
typedef typename Superclass::NeighborhoodAccessorFunctorType |
| 74 |
IND |
*********************************NeighborhoodAccessorFunctorType; |
| 75 |
|
|
| 76 |
|
/** Extract information from the image type. */ |
| 77 |
|
itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension); |
| 78 |
|
|
| 79 |
|
/** Default constructor. */ |
| 80 |
|
ZeroFluxNeumannBoundaryCondition() {} |
| 81 |
|
|
| 82 |
|
/** Computes and returns a neighborhood of appropriate values from |
| 83 |
|
* neighborhood iterator data.. */ |
| 84 |
|
virtual PixelType operator()(const OffsetType& point_index, |
| 85 |
|
const OffsetType& boundary_offset, |
| 86 |
|
const NeighborhoodType *data) const; |
| 87 |
|
|
| 88 |
|
/** Computes and returns the appropriate pixel value from |
| 89 |
|
* neighborhood iterator data, using the functor. */ |
| 90 |
|
virtual PixelType operator()( |
| 91 |
|
const OffsetType& point_index, |
| 92 |
|
const OffsetType& boundary_offset, |
| 93 |
|
const NeighborhoodType *data, |
| 94 |
|
const NeighborhoodAccessorFunctorType &neighborhoodAccessorFunctor) const; |
| 95 |
|
}; |
| 96 |
|
|
| 97 |
|
} // end namespace itk |
| 98 |
|
|
| 99 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 100 |
|
#include "itkZeroFluxNeumannBoundaryCondition.txx" |
| 101 |
|
#endif |
| 102 |
|
|
| 103 |
|
#endif |
| 104 |
|
|