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
00164 VectorOfDoubleType GetNewShape();
00165
00166 protected:
00167 ActiveShapeModelGradientSearchMethod();
00168 ~ActiveShapeModelGradientSearchMethod() {};
00169
00170 void PrintSelf(std::ostream& os, Indent indent) const;
00171
00172
00173 private:
00174 ActiveShapeModelGradientSearchMethod(const Self&);
00175 void operator=(const Self&);
00176
00177 bool m_Valid;
00178 VectorOfDoubleType m_MeanShape;
00179 MatrixOfDoubleType m_EigenVectors;
00180 VectorOfDoubleType m_EigenValues;
00181 unsigned int m_LenghtOfProfile;
00182 unsigned int m_NumberOfIteration;
00183 VectorOfDoubleType m_DiffVector;
00184 VectorOfDoubleType m_Db;
00185 VectorOfDoubleType m_Blimit;
00186 VectorOfDoubleType m_NewShape;
00187 InputImagePointer m_Image;
00188
00189
00190 };
00191
00192 }
00193
00194 #ifndef ITK_MANUAL_INSTANTIATION
00195 #include "itkActiveShapeModelGradientSearchMethod.txx"
00196 #endif
00197
00198 #endif
00199