| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkGaussianDerivativeSpatialFunction.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:36 $ |
| 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 __itkGaussianDerivativeSpatialFunction_h |
| 18 |
|
#define __itkGaussianDerivativeSpatialFunction_h |
| 19 |
|
|
| 20 |
|
#include "itkSpatialFunction.h" |
| 21 |
|
#include "itkFixedArray.h" |
| 22 |
|
#include "itkPoint.h" |
| 23 |
|
|
| 24 |
|
namespace itk |
| 25 |
|
{ |
| 26 |
|
|
| 27 |
|
/** \class GaussianDerivativeSpatialFunction |
| 28 |
|
* \brief N-dimensional gaussian spatial function class |
| 29 |
|
* |
| 30 |
LEN |
* GaussianDerivativeSpatialFunction implements a standard derivative of gaussian |
| 31 |
|
* curve in N-d. |
| 32 |
|
* m_Normalized determines whether or not the Derivative of the Gaussian |
| 33 |
|
* is normalized (whether or not the sum over infinite space is 1.0) |
| 34 |
|
* |
| 35 |
|
* m_Scale scales the output of the Gaussian to span a range |
| 36 |
|
* larger than 0->1, and is often set to the maximum value |
| 37 |
|
* of the output data type (for instance, 255 for uchars) |
| 38 |
|
* |
| 39 |
|
* \ingroup SpatialFunctions |
| 40 |
|
*/ |
| 41 |
|
template <typename TOutput=double, |
| 42 |
|
unsigned int VImageDimension=3, |
| 43 |
|
typename TInput=Point<double, VImageDimension> > |
| 44 |
LEN |
class ITK_EXPORT GaussianDerivativeSpatialFunction : public SpatialFunction<TOutput, VImageDimension, TInput> |
| 45 |
|
{ |
| 46 |
|
public: |
| 47 |
|
/** Standard class typedefs. */ |
| 48 |
|
typedef GaussianDerivativeSpatialFunction Self; |
| 49 |
TDA |
typedef SpatialFunction<TOutput, VImageDimension, TInput> Superclass; |
| 50 |
TDA |
typedef SmartPointer<Self> Pointer; |
| 51 |
TDA |
typedef SmartPointer<const Self> ConstPointer; |
| 52 |
|
|
| 53 |
|
/** Method for creation through the object factory. */ |
| 54 |
|
itkNewMacro(Self); |
| 55 |
|
|
| 56 |
|
/** Run-time type information (and related methods). */ |
| 57 |
|
itkTypeMacro(GaussianDerivativeSpatialFunction, SpatialFunction); |
| 58 |
|
|
| 59 |
|
/** Input type for the function. */ |
| 60 |
|
typedef typename Superclass::InputType InputType; |
| 61 |
|
|
| 62 |
|
/** Output type for the function. */ |
| 63 |
|
typedef typename Superclass::OutputType OutputType; |
| 64 |
|
|
| 65 |
|
/** Type used to store derivatives parameters. */ |
| 66 |
|
typedef FixedArray<double, VImageDimension> ArrayType; |
| 67 |
|
|
| 68 |
|
/** Type used to return the derivatives in each direction */ |
| 69 |
|
typedef Vector<double, VImageDimension> VectorType; |
| 70 |
|
|
| 71 |
|
/** Evaluate the function at a given position and return the |
| 72 |
|
* value in the specific direction. SetDirection() should be used |
| 73 |
|
* to set the direction.*/ |
| 74 |
|
OutputType Evaluate(const TInput& position) const; |
| 75 |
|
|
| 76 |
|
/** Evaluate the function at a given position and return a vector */ |
| 77 |
|
VectorType EvaluateVector(const TInput& position) const; |
| 78 |
|
|
| 79 |
|
/** Gets and sets for gaussian parameters */ |
| 80 |
|
itkSetMacro(Scale, double); |
| 81 |
|
itkGetMacro(Scale, double); |
| 82 |
|
itkSetMacro(Normalized, bool); |
| 83 |
|
itkGetMacro(Normalized, bool); |
| 84 |
|
itkSetMacro(Sigma, ArrayType); |
| 85 |
|
itkGetMacro(Sigma, ArrayType); |
| 86 |
|
itkSetMacro(Mean, ArrayType); |
| 87 |
|
itkGetMacro(Mean, ArrayType); |
| 88 |
|
itkSetMacro(Direction, unsigned int); |
| 89 |
|
itkGetMacro(Direction, unsigned int); |
| 90 |
|
|
| 91 |
|
protected: |
| 92 |
|
GaussianDerivativeSpatialFunction(); |
| 93 |
|
virtual ~GaussianDerivativeSpatialFunction(); |
| 94 |
|
void PrintSelf(std::ostream& os, Indent indent) const; |
| 95 |
|
|
| 96 |
|
private: |
| 97 |
|
GaussianDerivativeSpatialFunction(const Self&); //purposely not implemented |
| 98 |
|
void operator=(const Self&); //purposely not implemented |
| 99 |
|
|
| 100 |
|
/** Current direction */ |
| 101 |
|
unsigned int m_Direction; |
| 102 |
|
|
| 103 |
|
/** The standard deviation in each direction. */ |
| 104 |
|
ArrayType m_Sigma; |
| 105 |
|
|
| 106 |
|
/** The mean in each direction. */ |
| 107 |
|
ArrayType m_Mean; |
| 108 |
|
|
| 109 |
|
/** A scale factor multiplied by the true value of the Gaussian. */ |
| 110 |
|
double m_Scale; |
| 111 |
|
|
| 112 |
|
/** Whether or not to normalize the Gaussian. */ |
| 113 |
|
bool m_Normalized; |
| 114 |
|
|
| 115 |
|
}; |
| 116 |
|
|
| 117 |
|
} // end namespace itk |
| 118 |
|
|
| 119 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 120 |
|
#include "itkGaussianDerivativeSpatialFunction.txx" |
| 121 |
|
#endif |
| 122 |
|
|
| 123 |
|
#endif |
| 124 |
|
|