00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkNeighborhoodSampler_h
00018 #define __itkNeighborhoodSampler_h
00019
00020 #include "itkMacro.h"
00021 #include "itkObject.h"
00022 #include "itkSample.h"
00023 #include "itkSubsample.h"
00024 #include "itkArray.h"
00025 #include "itkSampleAlgorithmBase.h"
00026
00027 namespace itk{
00028 namespace Statistics{
00029
00047 template < class TSample >
00048 class ITK_EXPORT NeighborhoodSampler : public SampleAlgorithmBase< TSample >
00049 {
00050 public:
00052 typedef NeighborhoodSampler Self ;
00053 typedef SampleAlgorithmBase< TSample > Superclass ;
00054 typedef SmartPointer< Self > Pointer ;
00055 typedef SmartPointer< const Self > ConstPointer ;
00056
00058 itkTypeMacro(NeighborhoodSampler, SampleAlgorithmBase);
00059
00061 itkNewMacro(Self) ;
00062
00064 typedef TSample SampleType ;
00065
00066
00068 typedef typename TSample::MeasurementVectorType MeasurementVectorType ;
00069 typedef typename TSample::MeasurementType MeasurementType ;
00070 typedef typename TSample::FrequencyType FrequencyType ;
00071 typedef typename TSample::InstanceIdentifier InstanceIdentifier ;
00072
00074 typedef typename Superclass::InputSampleType InputSampleType ;
00075
00077 typedef Subsample< TSample > SubsampleType ;
00078
00080 typedef double RadiusType ;
00081
00083 typedef Array< double > CenterType;
00084
00086 void SetCenter(CenterType* center)
00087 {
00088 if( this->GetMeasurementVectorSize() &&
00089 ( center->Size() != this->GetMeasurementVectorSize() ) )
00090 {
00091 itkExceptionMacro( << "Size of measurement vectors in the sample is: " <<
00092 this->GetMeasurementVectorSize() << " but size of center is: " <<
00093 center->Size() );
00094 }
00095
00096 if ( m_Center != center )
00097 {
00098 m_Center = center ;
00099 this->Modified() ;
00100 }
00101 }
00102
00104 CenterType* GetCenter()
00105 { return m_Center ; }
00106
00108 void SetRadius(RadiusType* radius)
00109 {
00110 if ( m_Radius != radius )
00111 {
00112 m_Radius = radius ;
00113 this->Modified() ;
00114 }
00115 }
00117
00119 RadiusType* GetRadius()
00120 { return m_Radius ; }
00121
00123 typedef SubsampleType OutputType ;
00124
00126 typedef typename SubsampleType::Pointer OutputPointer ;
00127
00129 OutputPointer GetOutput() ;
00130
00131 protected:
00132 NeighborhoodSampler() ;
00133 virtual ~NeighborhoodSampler() {}
00134 virtual void PrintSelf(std::ostream& os, Indent indent) const ;
00135
00136 void GenerateData() ;
00137
00138 private:
00139 NeighborhoodSampler(const Self&) ;
00140 void operator=(const Self&) ;
00141
00142 CenterType* m_Center ;
00143 RadiusType* m_Radius ;
00144 typename SubsampleType::Pointer m_Subsample ;
00145 } ;
00146
00147 }
00148 }
00149
00150 #ifndef ITK_MANUAL_INSTANTIATION
00151 #include "itkNeighborhoodSampler.txx"
00152 #endif
00153
00154 #endif
00155