00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkNeighborhoodSampler.h,v $ 00005 Language: C++ 00006 Date: $Date: 2002/09/27 14:02:17 $ 00007 Version: $Revision: 1.4 $ 00008 00009 Copyright (c) 2002 Insight Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 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 "itkFixedArray.h" 00025 #include "itkSampleAlgorithmBase.h" 00026 00027 namespace itk{ 00028 namespace Statistics{ 00029 00040 template < class TSample > 00041 class ITK_EXPORT NeighborhoodSampler : public SampleAlgorithmBase< TSample > 00042 { 00043 public: 00045 typedef NeighborhoodSampler Self ; 00046 typedef SampleAlgorithmBase< TSample > Superclass ; 00047 typedef SmartPointer< Self > Pointer ; 00048 typedef SmartPointer< const Self > ConstPointer ; 00049 00051 itkTypeMacro(NeighborhoodSampler, SampleAlgorithmBase); 00052 00054 itkNewMacro(Self) ; 00055 00057 typedef TSample SampleType ; 00058 00060 itkStaticConstMacro(MeasurementVectorSize, unsigned int, 00061 TSample::MeasurementVectorSize) ; 00062 typedef typename TSample::MeasurementVectorType MeasurementVectorType ; 00063 typedef typename TSample::MeasurementType MeasurementType ; 00064 typedef typename TSample::FrequencyType FrequencyType ; 00065 typedef typename TSample::InstanceIdentifier InstanceIdentifier ; 00066 00068 typedef typename Superclass::InputSampleType InputSampleType ; 00069 00071 typedef Subsample< TSample > SubsampleType ; 00072 00074 typedef double RadiusType ; 00075 00077 typedef FixedArray< double, itkGetStaticConstMacro(MeasurementVectorSize) > CenterType ; 00078 00080 void SetCenter(CenterType* center) 00081 { 00082 if ( m_Center != center ) 00083 { 00084 m_Center = center ; 00085 this->Modified() ; 00086 } 00087 } 00088 00090 CenterType* GetCenter() 00091 { return m_Center ; } 00092 00094 void SetRadius(RadiusType* radius) 00095 { 00096 if ( m_Radius != radius ) 00097 { 00098 m_Radius = radius ; 00099 this->Modified() ; 00100 } 00101 } 00102 00104 RadiusType* GetRadius() 00105 { return m_Radius ; } 00106 00108 typedef SubsampleType OutputType ; 00109 00111 OutputType* GetOutput() ; 00112 00113 protected: 00114 NeighborhoodSampler() ; 00115 virtual ~NeighborhoodSampler() {} 00116 virtual void PrintSelf(std::ostream& os, Indent indent) const ; 00117 00118 void GenerateData() ; 00119 00120 private: 00121 NeighborhoodSampler(const Self&) ; //purposely not implemented 00122 void operator=(const Self&) ; //purposely not implemented 00123 00124 CenterType* m_Center ; 00125 RadiusType* m_Radius ; 00126 typename SubsampleType::Pointer m_Subsample ; 00127 } ; // end of class 00128 00129 } // end of namespace Statistics 00130 } // end of namespace itk 00131 00132 #ifndef ITK_MANUAL_INSTANTIATION 00133 #include "itkNeighborhoodSampler.txx" 00134 #endif 00135 00136 #endif