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;
00107
00109 typedef vnl_matrix<double> MatrixOfDoubleType;
00110
00112 typedef Statistics::ListSample< MeasurementVectorUIntType > SampleType;
00113
00115 typedef ImageRegionConstIterator< Image2DType > ConstIteratorType;
00116
00118 virtual void SetImage( const InputImageType * image )
00119 {
00120 if ( m_Image != image )
00121 {
00122 m_Image = image;
00123 this->Modified();
00124 m_Valid = false;
00125 }
00126 }
00128
00130 itkSetMacro( LenghtOfProfile, unsigned int );
00131 itkGetMacro( LenghtOfProfile, unsigned int );
00133
00135 itkSetMacro( NumberOfIteration, unsigned int );
00136 itkGetMacro( NumberOfIteration, unsigned int );
00138
00140 itkSetMacro( MeanShape, VectorOfDoubleType );
00141 itkGetMacro( MeanShape, VectorOfDoubleType );
00143
00145 itkSetMacro( EigenValues, VectorOfDoubleType );
00146 itkGetMacro( EigenValues, VectorOfDoubleType );
00148
00150 itkSetMacro( EigenVectors, MatrixOfDoubleType );
00151 itkGetMacro( EigenVectors, MatrixOfDoubleType );
00153
00154
00160 void GenerateData( );
00161
00163 VectorOfDoubleType GetNewShape();
00164
00165 protected:
00166 ActiveShapeModelGradientSearchMethod();
00167 ~ActiveShapeModelGradientSearchMethod() {};
00168
00169 void PrintSelf(std::ostream& os, Indent indent) const;
00170
00171
00172 private:
00173 ActiveShapeModelGradientSearchMethod(const Self&);
00174 void operator=(const Self&);
00175
00176 bool m_Valid;
00177 VectorOfDoubleType m_MeanShape;
00178 MatrixOfDoubleType m_EigenVectors;
00179 VectorOfDoubleType m_EigenValues;
00180 unsigned int m_LenghtOfProfile;
00181 unsigned int m_NumberOfIteration;
00182 VectorOfDoubleType m_DiffVector;
00183 VectorOfDoubleType m_Db;
00184 VectorOfDoubleType m_Blimit;
00185 VectorOfDoubleType m_NewShape;
00186 InputImagePointer m_Image;
00187
00188
00189 };
00190
00191 }
00192
00193 #ifndef ITK_MANUAL_INSTANTIATION
00194 #include "itkActiveShapeModelGradientSearchMethod.txx"
00195 #endif
00196
00197 #endif
00198