| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkVectorMeanImageFunction.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:49 $ |
| 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 _itkVectorMeanImageFunction_h |
| 18 |
DEF |
#define _itkVectorMeanImageFunction_h |
| 19 |
|
|
| 20 |
|
#include "itkImageFunction.h" |
| 21 |
|
#include "itkNumericTraits.h" |
| 22 |
|
|
| 23 |
|
namespace itk |
| 24 |
|
{ |
| 25 |
|
|
| 26 |
|
/** |
| 27 |
|
* \class VectorMeanImageFunction |
| 28 |
LEN |
* \brief Calculate the mean value in the neighborhood of a pixel in a Vector image. |
| 29 |
|
* |
| 30 |
|
* Calculate the mean pixel value over the standard 8, 26, etc. connected |
| 31 |
|
* neighborhood. This calculation uses a ZeroFluxNeumannBoundaryCondition. |
| 32 |
|
* |
| 33 |
|
* If called with a ContinuousIndex or Point, the calculation is performed |
| 34 |
|
* at the nearest neighbor. |
| 35 |
|
* |
| 36 |
|
* This class is templated over the input image type and the |
| 37 |
|
* coordinate representation type (e.g. float or double). |
| 38 |
|
* |
| 39 |
|
* \sa MeanImageFunction |
| 40 |
|
* |
| 41 |
|
* \ingroup ImageFunctions |
| 42 |
|
*/ |
| 43 |
|
template <class TInputImage, class TCoordRep = float > |
| 44 |
|
class ITK_EXPORT VectorMeanImageFunction : |
| 45 |
IND |
**public ImageFunction< TInputImage, |
| 46 |
|
FixedArray< |
| 47 |
LEN |
ITK_TYPENAME NumericTraits<typename TInputImage::PixelType::ValueType>::RealType, |
| 48 |
LEN,IND |
******::itk::GetVectorDimension<typename TInputImage::PixelType>::VectorDimension >, |
| 49 |
IND |
****TCoordRep > |
| 50 |
|
{ |
| 51 |
|
public: |
| 52 |
|
/** Standard class typedefs. */ |
| 53 |
|
typedef VectorMeanImageFunction Self; |
| 54 |
|
typedef ImageFunction<TInputImage, |
| 55 |
|
FixedArray< |
| 56 |
LEN |
ITK_TYPENAME NumericTraits<typename TInputImage::PixelType::ValueType>::RealType, |
| 57 |
LEN,IND |
******::itk::GetVectorDimension<typename TInputImage::PixelType>::VectorDimension >, |
| 58 |
TDA,IND |
****TCoordRep > Superclass; |
| 59 |
TDA |
typedef SmartPointer<Self> Pointer; |
| 60 |
TDA |
typedef SmartPointer<const Self> ConstPointer; |
| 61 |
|
|
| 62 |
|
/** Run-time type information (and related methods). */ |
| 63 |
|
itkTypeMacro(VectorMeanImageFunction, ImageFunction); |
| 64 |
|
|
| 65 |
|
/** Method for creation through the object factory. */ |
| 66 |
|
itkNewMacro(Self); |
| 67 |
|
|
| 68 |
|
/** InputImageType typedef support. */ |
| 69 |
|
typedef TInputImage InputImageType; |
| 70 |
|
|
| 71 |
|
/** OutputType typdef support. */ |
| 72 |
|
typedef typename Superclass::OutputType OutputType; |
| 73 |
|
|
| 74 |
|
/** Index typedef support. */ |
| 75 |
|
typedef typename Superclass::IndexType IndexType; |
| 76 |
|
|
| 77 |
|
/** ContinuousIndex typedef support. */ |
| 78 |
|
typedef typename Superclass::ContinuousIndexType ContinuousIndexType; |
| 79 |
|
|
| 80 |
|
/** Point typedef support. */ |
| 81 |
|
typedef typename Superclass::PointType PointType; |
| 82 |
|
|
| 83 |
|
/** Dimension of the underlying image. */ |
| 84 |
|
itkStaticConstMacro(ImageDimension, unsigned int, |
| 85 |
|
InputImageType::ImageDimension); |
| 86 |
|
|
| 87 |
|
/** Datatype used for the mean */ |
| 88 |
|
typedef FixedArray< |
| 89 |
LEN |
typename NumericTraits<typename InputImageType::PixelType::ValueType>::RealType, |
| 90 |
LEN,IND |
****::itk::GetVectorDimension<typename TInputImage::PixelType>::VectorDimension > |
| 91 |
LEN,IND |
****************************************************************************RealType; |
| 92 |
|
|
| 93 |
|
/** Evalulate the function at specified index */ |
| 94 |
|
virtual RealType EvaluateAtIndex( const IndexType& index ) const; |
| 95 |
|
|
| 96 |
|
/** Evaluate the function at non-integer positions */ |
| 97 |
|
virtual RealType Evaluate( const PointType& point ) const |
| 98 |
|
{ |
| 99 |
IND |
******IndexType index; |
| 100 |
IND |
******this->ConvertPointToNearestIndex( point, index ); |
| 101 |
IND |
******return this->EvaluateAtIndex( index ); |
| 102 |
|
} |
| 103 |
|
virtual RealType EvaluateAtContinuousIndex( |
| 104 |
|
const ContinuousIndexType& cindex ) const |
| 105 |
|
{ |
| 106 |
IND |
******IndexType index; |
| 107 |
IND |
******this->ConvertContinuousIndexToNearestIndex( cindex, index ); |
| 108 |
SEM,IND |
******return this->EvaluateAtIndex( index ) ; |
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
/** Get/Set the radius of the neighborhood over which the |
| 112 |
IND |
******statistics are evaluated */ |
| 113 |
|
itkSetMacro( NeighborhoodRadius, unsigned int ); |
| 114 |
|
itkGetConstReferenceMacro( NeighborhoodRadius, unsigned int ); |
| 115 |
|
|
| 116 |
|
protected: |
| 117 |
|
VectorMeanImageFunction(); |
| 118 |
|
~VectorMeanImageFunction(){}; |
| 119 |
|
void PrintSelf(std::ostream& os, Indent indent) const; |
| 120 |
|
|
| 121 |
|
private: |
| 122 |
|
VectorMeanImageFunction( const Self& ); //purposely not implemented |
| 123 |
|
void operator=( const Self& ); //purposely not implemented |
| 124 |
|
|
| 125 |
|
unsigned int m_NeighborhoodRadius; |
| 126 |
|
|
| 127 |
|
}; |
| 128 |
|
|
| 129 |
|
} // namespace itk |
| 130 |
|
|
| 131 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 132 |
|
#include "itkVectorMeanImageFunction.txx" |
| 133 |
|
#endif |
| 134 |
|
|
| 135 |
|
#endif |
| 136 |
|
|
| 137 |
EOF |
|