| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkBinaryThresholdSpatialFunction.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 |
DEF |
#ifndef _itkBinaryThresholdSpatialFunction_h |
| 18 |
DEF |
#define _itkBinaryThresholdSpatialFunction_h |
| 19 |
|
|
| 20 |
|
#include "itkSpatialFunction.h" |
| 21 |
|
#include "itkImageBase.h" |
| 22 |
|
|
| 23 |
|
namespace itk |
| 24 |
|
{ |
| 25 |
|
|
| 26 |
|
/** \class BinaryThresholdSpatialFunction |
| 27 |
|
* \brief A spatial functions that returns if the internal spatial function |
| 28 |
|
* is within user specified thresholds. |
| 29 |
|
* |
| 30 |
|
* BinaryThresholdSpatialFunction is a wrapper class for an internal |
| 31 |
|
* spatial function and returns true if it is within user specified |
| 32 |
|
* thresholds and false otherwise. |
| 33 |
|
* |
| 34 |
|
* This class is templated over the internal spatial function type. |
| 35 |
|
* |
| 36 |
|
* \sa SpatialFunction |
| 37 |
|
* |
| 38 |
|
* |
| 39 |
IND |
*/ |
| 40 |
|
template <typename TFunction> |
| 41 |
|
class ITK_EXPORT BinaryThresholdSpatialFunction : |
| 42 |
IND |
**public SpatialFunction< bool, |
| 43 |
|
::itk::GetImageDimension<TFunction>::ImageDimension, |
| 44 |
IND |
**************************ITK_TYPENAME TFunction::InputType > |
| 45 |
|
{ |
| 46 |
|
public: |
| 47 |
|
/** Standard class typedefs. */ |
| 48 |
|
typedef BinaryThresholdSpatialFunction Self; |
| 49 |
|
typedef SpatialFunction< bool, |
| 50 |
|
::itk::GetImageDimension<TFunction>::ImageDimension, |
| 51 |
TDA,IND |
***************************ITK_TYPENAME TFunction::InputType > Superclass; |
| 52 |
TDA |
typedef SmartPointer<Self> Pointer; |
| 53 |
TDA |
typedef SmartPointer<const Self> ConstPointer; |
| 54 |
|
|
| 55 |
|
/** Run-time type information (and related methods). */ |
| 56 |
|
itkTypeMacro(BinaryThresholdSpatialFunction, SpatialFunction); |
| 57 |
|
|
| 58 |
|
/** New macro for creation of through the object factory.*/ |
| 59 |
|
itkNewMacro( Self ); |
| 60 |
|
|
| 61 |
|
/** OutputType typedef support. */ |
| 62 |
|
typedef typename Superclass::OutputType OutputType; |
| 63 |
|
|
| 64 |
|
/** InputType typedef support. */ |
| 65 |
|
typedef typename TFunction::InputType InputType; |
| 66 |
|
|
| 67 |
|
/** Underlying function type. */ |
| 68 |
|
typedef TFunction FunctionType; |
| 69 |
|
|
| 70 |
|
/** Underlying function output type. */ |
| 71 |
|
typedef typename TFunction::OutputType FunctionOutputType; |
| 72 |
|
|
| 73 |
|
/** Set/Get the lower threshold. */ |
| 74 |
|
itkSetMacro( LowerThreshold, FunctionOutputType ); |
| 75 |
|
itkGetConstReferenceMacro( LowerThreshold, FunctionOutputType ); |
| 76 |
|
|
| 77 |
|
/** Set/Get the upper threshold. */ |
| 78 |
|
itkSetMacro( UpperThreshold, FunctionOutputType ); |
| 79 |
|
itkGetConstReferenceMacro( UpperThreshold, FunctionOutputType ); |
| 80 |
|
|
| 81 |
|
/** Set/Get the underlying function. */ |
| 82 |
|
itkSetObjectMacro( Function, FunctionType ); |
| 83 |
|
itkGetConstObjectMacro( Function, FunctionType ); |
| 84 |
|
|
| 85 |
|
/** Evaluate the function at a given position. */ |
| 86 |
|
virtual OutputType Evaluate( const InputType& point ) const; |
| 87 |
|
|
| 88 |
|
protected: |
| 89 |
|
|
| 90 |
|
BinaryThresholdSpatialFunction(); |
| 91 |
|
~BinaryThresholdSpatialFunction(); |
| 92 |
|
void PrintSelf(std::ostream& os, Indent indent) const; |
| 93 |
|
|
| 94 |
|
FunctionOutputType m_LowerThreshold; |
| 95 |
|
FunctionOutputType m_UpperThreshold; |
| 96 |
|
typename FunctionType::Pointer m_Function; |
| 97 |
|
|
| 98 |
|
private: |
| 99 |
|
BinaryThresholdSpatialFunction( const Self& ); //purposely not implemented |
| 100 |
|
void operator=( const Self& ); //purposely not implemented |
| 101 |
|
|
| 102 |
|
}; |
| 103 |
|
|
| 104 |
|
} // namespace itk |
| 105 |
|
|
| 106 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 107 |
|
#include "itkBinaryThresholdSpatialFunction.txx" |
| 108 |
|
#endif |
| 109 |
|
|
| 110 |
|
#endif |
| 111 |
|
|