1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
|
/*=========================================================================
Program: Advanced Normalization Tools
Module: $RCSfile: itkManifoldParzenWindowsPointSetFunction.h,v $
Language: C++
Date: $Date: 2008/11/15 23:46:06 $
Version: $Revision: 1.16 $
Copyright (c) ConsortiumOfANTS. All rights reserved.
See accompanying COPYING.txt or
http://sourceforge.net/projects/advants/files/ANTS/ANTSCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkManifoldParzenWindowsPointSetFunction_h
#define __itkManifoldParzenWindowsPointSetFunction_h
#include "itkPointSetFunction.h"
#include "itkGaussianMembershipFunction.h"
#include "itkKdTreeGenerator.h"
#include "itkListSample.h"
#include "itkMatrix.h"
#include "itkMersenneTwisterRandomVariateGenerator.h"
#include "itkMeshSource.h"
#include "itkPointSet.h"
#include "itkVector.h"
#include "itkWeightedCentroidKdTreeGenerator.h"
#include <vector>
namespace itk
{
/** \class ManifoldParzenWindowsPointSetFunction.h
* \brief point set filter.
*/
template <class TPointSet, class TOutput = double, class TCoordRep = double>
class ManifoldParzenWindowsPointSetFunction
: public PointSetFunction<TPointSet, TOutput, TCoordRep>
{
public:
typedef ManifoldParzenWindowsPointSetFunction Self;
typedef PointSetFunction<TPointSet, TOutput, TCoordRep> Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Extract dimension from output image. */
itkStaticConstMacro( Dimension, unsigned int,
TPointSet::PointDimension );
typedef typename Superclass::InputPointSetType InputPointSetType;
typedef typename Superclass::InputPointType InputPointType;
/** Point set typedef support. */
typedef TPointSet PointSetType;
typedef typename PointSetType::PointType PointType;
typedef typename PointSetType
::PointsContainerConstIterator PointsContainerConstIterator;
typedef Vector
<typename PointSetType::CoordRepType,
itkGetStaticConstMacro( Dimension )> MeasurementVectorType;
typedef typename Statistics::ListSample
<MeasurementVectorType> SampleType;
typedef typename Statistics
::WeightedCentroidKdTreeGenerator<SampleType> TreeGeneratorType;
typedef typename TreeGeneratorType::KdTreeType KdTreeType;
typedef typename KdTreeType
::InstanceIdentifierVectorType NeighborhoodIdentifierType;
/** Other typedef */
typedef TOutput RealType;
typedef TOutput OutputType;
typedef typename Statistics
::MersenneTwisterRandomVariateGenerator RandomizerType;
typedef typename Statistics::
GaussianMembershipFunction
<MeasurementVectorType> GaussianType;
typedef std::vector<typename GaussianType::Pointer> GaussianContainerType;
typedef typename GaussianType::MatrixType CovarianceMatrixType;
/** Helper functions */
itkSetMacro( CovarianceKNeighborhood, unsigned int );
itkGetConstMacro( CovarianceKNeighborhood, unsigned int );
itkSetMacro( EvaluationKNeighborhood, unsigned int );
itkGetConstMacro( EvaluationKNeighborhood, unsigned int );
itkSetMacro( RegularizationSigma, RealType );
itkGetConstMacro( RegularizationSigma, RealType );
itkSetMacro( KernelSigma, RealType );
itkGetConstMacro( KernelSigma, RealType );
itkSetMacro( BucketSize, unsigned int );
itkGetConstMacro( BucketSize, unsigned int );
itkSetMacro( Normalize, bool );
itkGetConstMacro( Normalize, bool );
itkBooleanMacro( Normalize );
itkSetMacro( UseAnisotropicCovariances, bool );
itkGetConstMacro( UseAnisotropicCovariances, bool );
itkBooleanMacro( UseAnisotropicCovariances );
virtual void SetInputPointSet( const InputPointSetType * ptr );
virtual TOutput Evaluate( const InputPointType& point ) const;
PointType GenerateRandomSample();
typename GaussianType::Pointer GetGaussian( unsigned int i )
{
if( i < this->m_Gaussians.size() )
{
return this->m_Gaussians[i].GetPointer();
}
else
{
return NULL;
}
this->Modified();
}
void SetGaussian( unsigned int i, typename GaussianType::Pointer gaussian )
{
if( i >= this->m_Gaussians.size() )
{
this->m_Gaussians.resize( i + 1 );
}
this->m_Gaussians[i] = gaussian;
this->Modified();
}
void GenerateKdTree();
NeighborhoodIdentifierType GetNeighborhoodIdentifiers(
MeasurementVectorType, unsigned int );
NeighborhoodIdentifierType GetNeighborhoodIdentifiers(
InputPointType, unsigned int );
protected:
ManifoldParzenWindowsPointSetFunction();
virtual ~ManifoldParzenWindowsPointSetFunction();
void PrintSelf( std::ostream& os, Indent indent ) const;
void GenerateData();
private:
// purposely not implemented
ManifoldParzenWindowsPointSetFunction( const Self & );
void operator=( const Self & );
unsigned int m_CovarianceKNeighborhood;
unsigned int m_EvaluationKNeighborhood;
unsigned int m_BucketSize;
RealType m_RegularizationSigma;
RealType m_KernelSigma;
typename TreeGeneratorType::Pointer m_KdTreeGenerator;
typename SampleType::Pointer m_SamplePoints;
typename RandomizerType::Pointer m_Randomizer;
GaussianContainerType m_Gaussians;
bool m_Normalize;
bool m_UseAnisotropicCovariances;
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkManifoldParzenWindowsPointSetFunction.hxx"
#endif
#endif
|