| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkNeighborhoodOperatorImageFunction.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 _itkNeighborhoodOperatorImageFunction_h |
| 18 |
DEF |
#define _itkNeighborhoodOperatorImageFunction_h |
| 19 |
|
|
| 20 |
|
#include "itkImageFunction.h" |
| 21 |
|
#include "itkNeighborhood.h" |
| 22 |
|
|
| 23 |
|
namespace itk |
| 24 |
|
{ |
| 25 |
|
|
| 26 |
|
/** |
| 27 |
|
* \class NeighborhoodOperatorImageFunction |
| 28 |
|
* \brief Compute the convolution of a neighborhood operator with the image |
| 29 |
|
* at a specific location in space, i.e. point, index or continuous |
| 30 |
|
* index. |
| 31 |
|
* This class is templated over the input image type. |
| 32 |
|
* \sa NeighborhoodOperator |
| 33 |
|
* \sa ImageFunction |
| 34 |
|
*/ |
| 35 |
|
template <class TInputImage,class TOutput> |
| 36 |
|
class ITK_EXPORT NeighborhoodOperatorImageFunction : |
| 37 |
IND |
**public ImageFunction< TInputImage, TOutput > |
| 38 |
|
{ |
| 39 |
|
public: |
| 40 |
|
|
| 41 |
|
/**Standard "Self" typedef */ |
| 42 |
|
typedef NeighborhoodOperatorImageFunction Self; |
| 43 |
|
|
| 44 |
|
/** Standard "Superclass" typedef*/ |
| 45 |
|
typedef ImageFunction<TInputImage, TOutput> Superclass; |
| 46 |
|
|
| 47 |
|
/** Smart pointer typedef support. */ |
| 48 |
|
typedef SmartPointer<Self> Pointer; |
| 49 |
TDA |
typedef SmartPointer<const Self> ConstPointer; |
| 50 |
|
|
| 51 |
|
/** Method for creation through the object factory.*/ |
| 52 |
|
itkNewMacro(Self); |
| 53 |
|
|
| 54 |
|
/** InputImageType typedef support.*/ |
| 55 |
|
typedef TInputImage InputImageType; |
| 56 |
|
typedef typename InputImageType::PixelType InputPixelType; |
| 57 |
|
typedef typename Superclass::IndexType IndexType; |
| 58 |
|
typedef typename Superclass::ContinuousIndexType ContinuousIndexType; |
| 59 |
|
|
| 60 |
|
/** Run-time type information (and related methods). */ |
| 61 |
|
itkTypeMacro( NeighborhoodOperatorImageFunction, ImageFunction ); |
| 62 |
|
|
| 63 |
|
|
| 64 |
|
/** Dimension of the underlying image. */ |
| 65 |
|
itkStaticConstMacro(ImageDimension, unsigned int, |
| 66 |
|
InputImageType::ImageDimension); |
| 67 |
|
|
| 68 |
LEN |
typedef Neighborhood<TOutput, itkGetStaticConstMacro(ImageDimension)> NeighborhoodType; |
| 69 |
|
|
| 70 |
|
/** Point typedef support. */ |
| 71 |
|
typedef typename Superclass::PointType PointType; |
| 72 |
|
|
| 73 |
|
/** Set the input image. */ |
| 74 |
|
//virtual void SetInputImage( InputImageType * ptr ); |
| 75 |
|
|
| 76 |
|
/** Sets the operator that is used to filter the image. Note |
| 77 |
|
* that the operator is stored as an internal COPY (it |
| 78 |
|
* is not part of the pipeline). */ |
| 79 |
|
void SetOperator(const NeighborhoodType &p) const |
| 80 |
|
{ |
| 81 |
|
m_Operator = p; |
| 82 |
|
this->Modified(); |
| 83 |
|
} |
| 84 |
|
|
| 85 |
|
/** Evalutate the in the given dimension at specified point |
| 86 |
|
* Subclasses should override this method. */ |
| 87 |
IND |
***virtual TOutput Evaluate(const PointType& ) const |
| 88 |
IND |
***{ |
| 89 |
LEN |
std::cout << "NeighborhoodOperatorImageFunction::Evaluate(): Not implemented!" << std::endl; |
| 90 |
|
TOutput out; |
| 91 |
|
out = 0; |
| 92 |
|
return out; |
| 93 |
IND |
***} |
| 94 |
|
/** Evaluate the function at specified Index position*/ |
| 95 |
|
virtual TOutput EvaluateAtIndex( const IndexType & index ) const; |
| 96 |
|
|
| 97 |
|
/** Evaluate the function at specified ContinousIndex position. |
| 98 |
|
* Subclasses should override this method. */ |
| 99 |
|
virtual TOutput EvaluateAtContinuousIndex( |
| 100 |
|
const ContinuousIndexType & ) const |
| 101 |
IND |
**{ |
| 102 |
LEN |
std::cout << "NeighborhoodOperatorImageFunction::EvaluateAtContinuousIndex():Not implemented!" << std::endl; |
| 103 |
|
TOutput out; |
| 104 |
|
out = 0; |
| 105 |
|
return out; |
| 106 |
IND |
**} |
| 107 |
|
|
| 108 |
|
protected: |
| 109 |
|
NeighborhoodOperatorImageFunction(); |
| 110 |
|
NeighborhoodOperatorImageFunction( const Self& ){}; |
| 111 |
|
|
| 112 |
|
~NeighborhoodOperatorImageFunction(){}; |
| 113 |
|
|
| 114 |
|
void operator=( const Self& ){}; |
| 115 |
|
void PrintSelf(std::ostream& os, Indent indent) const; |
| 116 |
|
|
| 117 |
|
private: |
| 118 |
|
|
| 119 |
|
mutable NeighborhoodType m_Operator; |
| 120 |
|
|
| 121 |
|
}; |
| 122 |
|
|
| 123 |
|
} // namespace itk |
| 124 |
|
|
| 125 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 126 |
|
#include "itkNeighborhoodOperatorImageFunction.txx" |
| 127 |
|
#endif |
| 128 |
|
|
| 129 |
|
#endif |
| 130 |
|
|
| 131 |
EOF |
|