00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkSampleAlgorithmBase.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-03-04 19:29:53 $ 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 00018 #ifndef __itkSampleAlgorithmBase_h 00019 #define __itkSampleAlgorithmBase_h 00020 00021 #include <vnl/vnl_vector.h> 00022 #include <vnl/vnl_matrix.h> 00023 00024 #include "itkMacro.h" 00025 #include "itkObjectFactory.h" 00026 #include "itkObject.h" 00027 #include "itkMeasurementVectorTraits.h" 00028 00029 namespace itk { 00030 namespace Statistics { 00031 00040 template< class TInputSample > 00041 class ITK_EXPORT SampleAlgorithmBase : public Object 00042 { 00043 public: 00045 typedef SampleAlgorithmBase Self; 00046 typedef Object Superclass; 00047 typedef SmartPointer< Self > Pointer; 00048 typedef SmartPointer< const Self > ConstPointer; 00049 00051 itkTypeMacro(SampleAlgorithmBase, Object); 00052 itkNewMacro(Self); 00054 00056 typedef unsigned int MeasurementVectorSizeType; 00057 00059 typedef TInputSample InputSampleType; 00060 typedef typename InputSampleType::MeasurementVectorType MeasurementVectorType; 00061 00063 void SetInputSample( const TInputSample * sample ) 00064 { 00065 if ( m_InputSample != sample ) 00066 { 00067 m_InputSample = sample; 00068 m_MeasurementVectorSize = m_InputSample->GetMeasurementVectorSize(); 00069 this->Modified(); 00070 } 00071 } 00073 00074 00079 itkGetConstMacro( MeasurementVectorSize, MeasurementVectorSizeType ); 00080 itkSetMacro( MeasurementVectorSize, MeasurementVectorSizeType ) 00081 00082 const TInputSample * GetInputSample() const 00083 { return m_InputSample.GetPointer(); } 00084 00088 void Update() 00089 { this->GenerateData(); } 00090 00091 protected: 00092 SampleAlgorithmBase(); 00093 virtual ~SampleAlgorithmBase() {} 00094 void PrintSelf(std::ostream& os, Indent indent) const; 00095 00097 virtual void GenerateData(); 00098 00099 private: 00101 MeasurementVectorSizeType m_MeasurementVectorSize; 00102 00104 typename TInputSample::ConstPointer m_InputSample; 00105 }; // end of class 00106 00107 } // end of namespace Statistics 00108 } // end of namespace itk 00109 00110 #ifndef ITK_MANUAL_INSTANTIATION 00111 #include "itkSampleAlgorithmBase.txx" 00112 #endif 00113 00114 #endif 00115