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

Numerics/Statistics/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: 2009-03-04 15:24:04 $
00007   Version:   $Revision: 1.8 $
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     }
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&); //purposely not implemented
00140   void operator=(const Self&); //purposely not implemented
00141   
00142   CenterType*                     m_Center;
00143   RadiusType*                     m_Radius;
00144   typename SubsampleType::Pointer m_Subsample;
00145 }; // end of class
00146 
00147 } // end of namespace Statistics 
00148 } // end of namespace itk
00149 
00150 #ifndef ITK_MANUAL_INSTANTIATION
00151 #include "itkNeighborhoodSampler.txx"
00152 #endif
00153 
00154 #endif
00155 

Generated at Fri Apr 16 19:11:02 2010 for ITK by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2000