Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkNeighborhoodSampler.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkNeighborhoodSampler.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005/07/26 15:55:04 $
00007   Version:   $Revision: 1.7 $
00008 
00009   Copyright (c) Insight Software 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 "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   }
00116 
00118   RadiusType* GetRadius()
00119   { return m_Radius ; } 
00120 
00122   typedef SubsampleType OutputType ;
00123 
00125   typedef typename SubsampleType::Pointer OutputPointer ;
00126 
00128   OutputPointer GetOutput() ;
00129 
00130 protected:
00131   NeighborhoodSampler() ;
00132   virtual ~NeighborhoodSampler() {}
00133   virtual void PrintSelf(std::ostream& os, Indent indent) const ;
00134 
00135   void GenerateData() ;
00136 
00137 private:
00138   NeighborhoodSampler(const Self&) ; //purposely not implemented
00139   void operator=(const Self&) ; //purposely not implemented
00140   
00141   CenterType* m_Center ;
00142   RadiusType* m_Radius ;
00143   typename SubsampleType::Pointer m_Subsample ;
00144 } ; // end of class
00145 
00146 } // end of namespace Statistics 
00147 } // end of namespace itk
00148 
00149 #ifndef ITK_MANUAL_INSTANTIATION
00150 #include "itkNeighborhoodSampler.txx"
00151 #endif
00152 
00153 #endif

Generated at Wed May 24 23:46:40 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000