00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _itkActiveShapeModelGradientSearchMethod_h
00018 #define _itkActiveShapeModelGradientSearchMethod_h
00019
00020 #include <time.h>
00021 #include <math.h>
00022
00023 #include "vnl/vnl_vector.h"
00024 #include "vnl/vnl_matrix.h"
00025 #include "vnl/vnl_math.h"
00026
00027 #include "itkImageToImageFilter.h"
00028 #include "itkImage.h"
00029 #include "itkNumericTraits.h"
00030
00031
00032 #include "itkImageRegionConstIterator.h"
00033
00034 #include "itkGradientMagnitudeImageFilter.h"
00035
00036
00037 #include "itkVector.h"
00038 #include "itkListSample.h"
00039 #include "itkExceptionObject.h"
00040
00041 #include "itkConceptChecking.h"
00042
00043 #include <vector>
00044 #include <list>
00045
00046 namespace itk{
00047
00063 template < class TImage >
00064 class ITK_EXPORT ActiveShapeModelGradientSearchMethod : public Object
00065 {
00066 public:
00067
00069 typedef ActiveShapeModelGradientSearchMethod<TImage> Self;
00070 typedef Object Superclass;
00071 typedef SmartPointer<Self> Pointer;
00072 typedef SmartPointer<const Self> ConstPointer;
00073
00075 itkNewMacro(Self);
00076
00078 itkTypeMacro(ActiveShapeModelGradientSearchMethod, Object);
00079
00081 typedef TImage InputImageType;
00082 typedef Image< double, 2 > Image2DType;
00083
00085 typedef typename InputImageType::RegionType RegionType;
00086
00088 typedef typename RegionType::IndexType IndexType;
00089
00091 typedef typename InputImageType::PixelType PixelType ;
00092
00094 typedef typename RegionType::SizeType SizeType;
00095
00097 typedef typename InputImageType::ConstPointer InputImagePointer;
00098
00100 typedef GradientMagnitudeImageFilter< InputImageType, Image2DType> GradientFilterType;
00101
00103 typedef Vector< unsigned int, 2 > MeasurementVectorUIntType;
00104 typedef Vector< double, 2 > MeasurementVectorDoubleType;
00105 typedef std::vector<unsigned int> VectorType;
00106 typedef vnl_vector<double> VectorOfDoubleType;
00108 typedef vnl_matrix<double> MatrixOfDoubleType;
00109
00111 typedef Statistics::ListSample< MeasurementVectorUIntType > SampleType;
00112
00114 typedef ImageRegionConstIterator< Image2DType > ConstIteratorType;
00115
00117 virtual void SetImage( const InputImageType * image )
00118 {
00119 if ( m_Image != image )
00120 {
00121 m_Image = image;
00122 this->Modified();
00123 m_Valid = false;
00124 }
00125 }
00126
00128 itkSetMacro( LenghtOfProfile, unsigned int );
00129 itkGetMacro( LenghtOfProfile, unsigned int );
00130
00132 itkSetMacro( NumberOfIteration, unsigned int );
00133 itkGetMacro( NumberOfIteration, unsigned int );
00134
00136 itkSetMacro( MeanShape, VectorOfDoubleType );
00137 itkGetMacro( MeanShape, VectorOfDoubleType );
00138
00140 itkSetMacro( EigenValues, VectorOfDoubleType );
00141 itkGetMacro( EigenValues, VectorOfDoubleType );
00142
00144 itkSetMacro( EigenVectors, MatrixOfDoubleType );
00145 itkGetMacro( EigenVectors, MatrixOfDoubleType );
00146
00147
00153 void GenerateData( );
00154
00156 VectorOfDoubleType GetNewShape();
00157
00158 protected:
00159 ActiveShapeModelGradientSearchMethod();
00160 ~ActiveShapeModelGradientSearchMethod() {};
00161
00162 void PrintSelf(std::ostream& os, Indent indent) const;
00163
00164
00165 private:
00166 ActiveShapeModelGradientSearchMethod(const Self&);
00167 void operator=(const Self&);
00168
00169 bool m_Valid;
00170 VectorOfDoubleType m_MeanShape;
00171 MatrixOfDoubleType m_EigenVectors;
00172 VectorOfDoubleType m_EigenValues;
00173 unsigned int m_LenghtOfProfile;
00174 unsigned int m_NumberOfIteration;
00175 VectorOfDoubleType m_DiffVector;
00176 VectorOfDoubleType m_Db;
00177 VectorOfDoubleType m_Blimit;
00178 VectorOfDoubleType m_NewShape;
00179 InputImagePointer m_Image;
00180
00181
00182 };
00183
00184 }
00185
00186 #ifndef ITK_MANUAL_INSTANTIATION
00187 #include "itkActiveShapeModelGradientSearchMethod.txx"
00188 #endif
00189
00190 #endif