| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkNeighborhoodBinaryThresholdImageFunction.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 |
DEF |
#ifndef _itkNeighborhoodBinaryThresholdImageFunction_h |
| 18 |
DEF |
#define _itkNeighborhoodBinaryThresholdImageFunction_h |
| 19 |
|
|
| 20 |
|
#include "itkBinaryThresholdImageFunction.h" |
| 21 |
|
|
| 22 |
|
namespace itk |
| 23 |
|
{ |
| 24 |
|
|
| 25 |
|
/** |
| 26 |
|
* \class NeighborhoodBinaryThresholdImageFunction |
| 27 |
LEN |
* \brief Determine whether all the pixels in the specified neighborhood meet a threshold criteria |
| 28 |
|
* |
| 29 |
|
* Determine whether all the pixels in the specified neighborhood meet |
| 30 |
|
* a threshold criteria. |
| 31 |
|
* |
| 32 |
|
* If called with a ContinuousIndex or Point, the calculation is performed |
| 33 |
|
* at the nearest neighbor. |
| 34 |
|
* |
| 35 |
|
* This class is templated over the input image type and the coordinate |
| 36 |
|
* representation type (e.g. float or double). |
| 37 |
|
* |
| 38 |
|
* \ingroup ImageFunctions |
| 39 |
|
*/ |
| 40 |
|
template <class TInputImage, class TCoordRep = float > |
| 41 |
|
class ITK_EXPORT NeighborhoodBinaryThresholdImageFunction : |
| 42 |
IND |
**public BinaryThresholdImageFunction< TInputImage, TCoordRep > |
| 43 |
|
{ |
| 44 |
|
public: |
| 45 |
|
/** Standard class typedefs. */ |
| 46 |
|
typedef NeighborhoodBinaryThresholdImageFunction Self; |
| 47 |
TDA |
typedef BinaryThresholdImageFunction<TInputImage,TCoordRep> Superclass; |
| 48 |
TDA |
typedef SmartPointer<Self> Pointer; |
| 49 |
TDA |
typedef SmartPointer<const Self> ConstPointer; |
| 50 |
|
|
| 51 |
|
/** Run-time type information (and related methods). */ |
| 52 |
LEN |
itkTypeMacro(NeighborhoodBinaryThresholdImageFunction, BinaryThresholdImageFunction); |
| 53 |
|
|
| 54 |
|
/** Method for creation through the object factory. */ |
| 55 |
|
itkNewMacro(Self); |
| 56 |
|
|
| 57 |
|
/** InputImageType typedef support. */ |
| 58 |
|
typedef TInputImage InputImageType; |
| 59 |
|
|
| 60 |
|
/** OutputType typdef support. */ |
| 61 |
|
typedef typename Superclass::OutputType OutputType; |
| 62 |
|
|
| 63 |
|
/** Index typedef support. */ |
| 64 |
|
typedef typename Superclass::IndexType IndexType; |
| 65 |
|
|
| 66 |
|
/** ContinuousIndex typedef support. */ |
| 67 |
|
typedef typename Superclass::ContinuousIndexType ContinuousIndexType; |
| 68 |
|
|
| 69 |
|
/** Point typedef support. */ |
| 70 |
|
typedef typename Superclass::PointType PointType; |
| 71 |
|
|
| 72 |
|
/** PixelType typedef support. */ |
| 73 |
|
typedef typename Superclass::PixelType PixelType; |
| 74 |
|
|
| 75 |
|
/** Dimension of the underlying image. */ |
| 76 |
|
itkStaticConstMacro(ImageDimension, unsigned int, |
| 77 |
|
InputImageType::ImageDimension); |
| 78 |
|
|
| 79 |
|
/** SizeType of the input image */ |
| 80 |
|
typedef typename InputImageType::SizeType InputSizeType; |
| 81 |
|
|
| 82 |
|
/** Set the radius of the neighborhood used in computation. */ |
| 83 |
|
itkSetMacro(Radius, InputSizeType); |
| 84 |
|
|
| 85 |
|
/** Get the radius of the neighborhood used in computation */ |
| 86 |
|
itkGetConstReferenceMacro(Radius, InputSizeType); |
| 87 |
|
|
| 88 |
|
/** Evalulate the function at specified index */ |
| 89 |
|
virtual bool EvaluateAtIndex( const IndexType& index ) const; |
| 90 |
|
|
| 91 |
|
/** Evaluate the function at non-integer positions */ |
| 92 |
|
virtual bool Evaluate( const PointType& point ) const |
| 93 |
|
{ |
| 94 |
IND |
******IndexType index; |
| 95 |
IND |
******this->ConvertPointToNearestIndex( point, index ); |
| 96 |
IND |
******return this->EvaluateAtIndex( index ); |
| 97 |
|
} |
| 98 |
|
virtual bool EvaluateAtContinuousIndex( |
| 99 |
|
const ContinuousIndexType& cindex ) const |
| 100 |
|
{ |
| 101 |
IND |
******IndexType index; |
| 102 |
IND |
******this->ConvertContinuousIndexToNearestIndex( cindex, index ); |
| 103 |
SEM,IND |
******return this->EvaluateAtIndex( index ) ; |
| 104 |
|
} |
| 105 |
|
|
| 106 |
|
protected: |
| 107 |
|
NeighborhoodBinaryThresholdImageFunction(); |
| 108 |
|
~NeighborhoodBinaryThresholdImageFunction(){}; |
| 109 |
|
void PrintSelf(std::ostream& os, Indent indent) const; |
| 110 |
|
|
| 111 |
|
private: |
| 112 |
LEN |
NeighborhoodBinaryThresholdImageFunction( const Self& ); //purposely not implemented |
| 113 |
|
void operator=( const Self& ); //purposely not implemented |
| 114 |
|
|
| 115 |
|
InputSizeType m_Radius; |
| 116 |
|
}; |
| 117 |
|
|
| 118 |
|
} // namespace itk |
| 119 |
|
|
| 120 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 121 |
|
#include "itkNeighborhoodBinaryThresholdImageFunction.txx" |
| 122 |
|
#endif |
| 123 |
|
|
| 124 |
|
#endif |
| 125 |
|
|
| 126 |
EOF |
|