| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkDerivativeOperator.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:34 $ |
| 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 __itkDerivativeOperator_h |
| 18 |
|
#define __itkDerivativeOperator_h |
| 19 |
|
|
| 20 |
|
#include "itkExceptionObject.h" |
| 21 |
|
#include "itkNeighborhoodOperator.h" |
| 22 |
|
|
| 23 |
|
namespace itk { |
| 24 |
|
|
| 25 |
|
/** |
| 26 |
|
* \class DerivativeOperator |
| 27 |
|
* \brief A NeighborhoodOperator for taking an n-th order derivative |
| 28 |
|
* at a pixel |
| 29 |
|
* |
| 30 |
|
* DerivativeOperator's coefficients are a tightest-fitting convolution |
| 31 |
|
* kernel for calculating the n-th order directional derivative at a pixel. |
| 32 |
|
* DerivativeOperator is a directional NeighborhoodOperator that should be |
| 33 |
|
* applied to a Neighborhood or NeighborhoodPointer using the inner product |
| 34 |
|
* method. |
| 35 |
|
* |
| 36 |
|
* \sa NeighborhoodOperator |
| 37 |
|
* \sa Neighborhood |
| 38 |
|
* \sa ForwardDifferenceOperator |
| 39 |
|
* \sa BackwardDifferenceOperator |
| 40 |
|
* |
| 41 |
|
* \ingroup Operators |
| 42 |
|
*/ |
| 43 |
|
template<class TPixel, unsigned int VDimension=2, |
| 44 |
|
class TAllocator = NeighborhoodAllocator<TPixel> > |
| 45 |
|
class ITK_EXPORT DerivativeOperator |
| 46 |
IND |
**: public NeighborhoodOperator<TPixel, VDimension, TAllocator> |
| 47 |
|
{ |
| 48 |
|
|
| 49 |
|
public: |
| 50 |
|
/** Standard class typedefs. */ |
| 51 |
|
typedef DerivativeOperator Self; |
| 52 |
TDA |
typedef NeighborhoodOperator<TPixel, VDimension, TAllocator> Superclass; |
| 53 |
|
|
| 54 |
|
typedef typename Superclass::PixelType PixelType; |
| 55 |
|
|
| 56 |
|
/** Constructor. */ |
| 57 |
|
DerivativeOperator() : m_Order(1) {} |
| 58 |
|
|
| 59 |
|
/** Copy constructor. */ |
| 60 |
|
DerivativeOperator(const Self& other) |
| 61 |
IND |
****: NeighborhoodOperator<TPixel, VDimension, TAllocator>(other) |
| 62 |
IND |
**{ m_Order = other.m_Order; } |
| 63 |
|
|
| 64 |
|
/** Assignment operator */ |
| 65 |
|
Self &operator=(const Self& other) |
| 66 |
IND |
**{ |
| 67 |
|
Superclass::operator=(other); |
| 68 |
|
m_Order = other.m_Order; |
| 69 |
|
return *this; |
| 70 |
IND |
**} |
| 71 |
|
|
| 72 |
|
/** Sets the order of the derivative. */ |
| 73 |
|
void SetOrder(const unsigned int &order) |
| 74 |
IND |
**{ m_Order = order; } |
| 75 |
|
|
| 76 |
|
/** Returns the order of the derivative. */ |
| 77 |
|
unsigned int GetOrder() const { return m_Order; } |
| 78 |
|
|
| 79 |
|
/** Prints some debugging information */ |
| 80 |
|
virtual void PrintSelf(std::ostream &os, Indent i) const |
| 81 |
IND |
**{ |
| 82 |
|
os << i << "DerivativeOperator { this=" << this |
| 83 |
IND |
*******<< ", m_Order = " << m_Order << "}" << std::endl; |
| 84 |
|
Superclass::PrintSelf(os, i.GetNextIndent()); |
| 85 |
IND |
**} |
| 86 |
|
|
| 87 |
|
protected: |
| 88 |
|
/** Typedef support for coefficient vector type. Necessary to |
| 89 |
|
* work around compiler bug on VC++. */ |
| 90 |
|
typedef typename Superclass::CoefficientVector CoefficientVector; |
| 91 |
|
|
| 92 |
|
/** Calculates operator coefficients. */ |
| 93 |
|
CoefficientVector GenerateCoefficients(); |
| 94 |
|
|
| 95 |
|
/** Arranges coefficients spatially in the memory buffer. */ |
| 96 |
|
void Fill(const CoefficientVector &coeff) |
| 97 |
IND |
**{ Superclass::FillCenteredDirectional(coeff); } |
| 98 |
|
|
| 99 |
|
private: |
| 100 |
|
/** Order of the derivative. */ |
| 101 |
|
unsigned int m_Order; |
| 102 |
|
}; |
| 103 |
|
|
| 104 |
|
} // namespace itk |
| 105 |
|
|
| 106 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 107 |
|
#include "itkDerivativeOperator.txx" |
| 108 |
|
#endif |
| 109 |
|
|
| 110 |
|
#endif |
| 111 |
|
|
| 112 |
EOF |
|
| 113 |
EOF,EML |
|