| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkBinaryBallStructuringElement.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:33 $ |
| 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 __itkBinaryBallStructuringElement_h |
| 18 |
|
#define __itkBinaryBallStructuringElement_h |
| 19 |
|
|
| 20 |
|
#include "itkNeighborhood.h" |
| 21 |
|
|
| 22 |
|
namespace itk { |
| 23 |
|
|
| 24 |
|
/** \class BinaryBallStructuringElement |
| 25 |
LEN |
* \brief A Neighborhood that represents a ball structuring element (ellipsoid) with binary elements. |
| 26 |
|
* |
| 27 |
|
* This class defines a Neighborhood whose elements are either 0 or 1 |
| 28 |
|
* depending on whether they are outside or inside an ellipsoid whose |
| 29 |
|
* radii match the radii of the Neighborhood. This class can be used |
| 30 |
|
* as a structuring element for the Morphology image filters. |
| 31 |
|
* |
| 32 |
|
* A BinaryBallStructuringElement has an N-dimensional \em radius. |
| 33 |
|
* The radius is defined separately for each dimension as the number |
| 34 |
|
* of pixels that the neighborhood extends outward from the center |
| 35 |
|
* pixel. For example, a 2D BinaryBallStructuringElement object with |
| 36 |
|
* a radius of 2x3 has sides of length 5x7. |
| 37 |
|
* |
| 38 |
|
* BinaryBallStructuringElement objects always have an unambiguous |
| 39 |
|
* center because their side lengths are always odd. |
| 40 |
|
* |
| 41 |
|
* \sa Neighborhood |
| 42 |
|
* \sa MorphologyImageFilter |
| 43 |
|
* \sa BinaryDilateImageFilter |
| 44 |
|
* \sa BinaryErodeImageFilter |
| 45 |
|
* |
| 46 |
|
* \ingroup Operators |
| 47 |
|
* \ingroup ImageIterators |
| 48 |
|
*/ |
| 49 |
|
|
| 50 |
|
template<class TPixel, unsigned int VDimension = 2, |
| 51 |
|
class TAllocator = NeighborhoodAllocator<TPixel> > |
| 52 |
|
class ITK_EXPORT BinaryBallStructuringElement |
| 53 |
IND |
**: public Neighborhood<TPixel, VDimension, TAllocator> |
| 54 |
|
{ |
| 55 |
|
public: |
| 56 |
|
/** Standard class typedefs. */ |
| 57 |
|
typedef BinaryBallStructuringElement Self; |
| 58 |
TDA |
typedef Neighborhood<TPixel, VDimension, TAllocator> Superclass; |
| 59 |
|
|
| 60 |
|
/** External support for allocator type. */ |
| 61 |
|
typedef TAllocator AllocatorType; |
| 62 |
|
|
| 63 |
|
/** External support for dimensionality. */ |
| 64 |
|
itkStaticConstMacro(NeighborhoodDimension, unsigned int, VDimension); |
| 65 |
|
|
| 66 |
|
/** External support for pixel type. */ |
| 67 |
|
typedef TPixel PixelType; |
| 68 |
|
|
| 69 |
|
/** Iterator typedef support. Note the naming is intentional, i.e., |
| 70 |
IND |
*** ::iterator and ::const_iterator, because the allocator may be a |
| 71 |
IND |
*** vnl object or other type, which uses this form. */ |
| 72 |
|
typedef typename AllocatorType::iterator Iterator; |
| 73 |
TDA |
typedef typename AllocatorType::const_iterator ConstIterator; |
| 74 |
|
|
| 75 |
|
/** Size and value typedef support. */ |
| 76 |
|
typedef typename Superclass::SizeType SizeType; |
| 77 |
TDA |
typedef typename Superclass::SizeValueType SizeValueType; |
| 78 |
|
|
| 79 |
|
/** Radius typedef support. */ |
| 80 |
|
typedef typename Superclass::RadiusType RadiusType; |
| 81 |
|
|
| 82 |
|
/** External slice iterator type typedef support. */ |
| 83 |
|
typedef SliceIterator<TPixel, Self> SliceIteratorType; |
| 84 |
|
|
| 85 |
|
/** Default constructor. */ |
| 86 |
|
BinaryBallStructuringElement() {} |
| 87 |
|
|
| 88 |
|
/** Default destructor. */ |
| 89 |
|
virtual ~BinaryBallStructuringElement() {} |
| 90 |
|
|
| 91 |
|
/** Copy constructor. */ |
| 92 |
|
BinaryBallStructuringElement(const Self& other) |
| 93 |
IND |
****: Neighborhood<TPixel, VDimension, TAllocator>(other) |
| 94 |
IND |
**{ |
| 95 |
IND |
**} |
| 96 |
|
|
| 97 |
|
/** Assignment operator. */ |
| 98 |
|
Self &operator=(const Self& other) |
| 99 |
IND |
**{ |
| 100 |
|
Superclass::operator=(other); |
| 101 |
|
return *this; |
| 102 |
IND |
**} |
| 103 |
|
|
| 104 |
|
/** Build the structuring element */ |
| 105 |
|
void CreateStructuringElement(); |
| 106 |
|
|
| 107 |
|
protected: |
| 108 |
|
|
| 109 |
|
private: |
| 110 |
|
|
| 111 |
|
}; |
| 112 |
|
|
| 113 |
|
} // namespace itk |
| 114 |
|
|
| 115 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 116 |
|
#include "itkBinaryBallStructuringElement.txx" |
| 117 |
|
#endif |
| 118 |
|
|
| 119 |
|
#endif |
| 120 |
|
|