00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _itkPCAShapeSignedDistanceFunction_h
00018 #define _itkPCAShapeSignedDistanceFunction_h
00019
00020
00021 #include "itkShapeSignedDistanceFunction.h"
00022 #include "itkImage.h"
00023 #include "itkInterpolateImageFunction.h"
00024 #include "itkExtrapolateImageFunction.h"
00025
00026 namespace itk
00027 {
00028
00029
00064 template< typename TCoordRep,
00065 unsigned int VSpaceDimension,
00066 typename TImage = Image<double,VSpaceDimension> >
00067 class ITK_EXPORT PCAShapeSignedDistanceFunction :
00068 public ShapeSignedDistanceFunction<TCoordRep, VSpaceDimension>
00069 {
00070
00071 public:
00073 typedef PCAShapeSignedDistanceFunction Self;
00074 typedef ShapeSignedDistanceFunction<
00075 TCoordRep, VSpaceDimension> Superclass;
00076 typedef SmartPointer<Self> Pointer;
00077 typedef SmartPointer<const Self> ConstPointer;
00078
00079
00081 itkTypeMacro(PCAShapeSignedDistanceFunction, ShapeSignedDistancFunction);
00082
00084 itkNewMacro(Self);
00085
00087 itkStaticConstMacro(SpaceDimension,unsigned int,Superclass::SpaceDimension);
00088
00089
00091 typedef typename Superclass::CoordRepType CoordRepType;
00092
00094 typedef typename Superclass::InputType InputType;
00095
00097 typedef typename Superclass::OutputType OutputType;
00098
00100 typedef typename Superclass::PointType PointType;
00101
00103 typedef typename Superclass::ParametersType ParametersType;
00104
00105
00107 typedef TImage ImageType;
00108 typedef typename ImageType::Pointer ImagePointer;
00109 typedef std::vector<ImagePointer> ImagePointerVector;
00110
00112 typedef Transform<CoordRepType,
00113 itkGetStaticConstMacro(SpaceDimension),
00114 itkGetStaticConstMacro(SpaceDimension)> TransformType;
00115
00117 typedef InterpolateImageFunction<ImageType, CoordRepType> InterpolatorType;
00118 typedef typename InterpolatorType::Pointer InterpolatorPointer;
00119 typedef std::vector<InterpolatorPointer> InterpolatorPointerVector;
00120
00122 typedef ExtrapolateImageFunction<ImageType, CoordRepType> ExtrapolatorType;
00123 typedef typename ExtrapolatorType::Pointer ExtrapolatorPointer;
00124 typedef std::vector<ExtrapolatorPointer> ExtrapolatorPointerVector;
00125
00127 typedef ImageFunction<ImageType, double, CoordRepType> FunctionType;
00128 typedef typename FunctionType::Pointer FunctionPointer;
00129 typedef std::vector<FunctionPointer> FunctionPointerVector;
00130
00131
00134 void SetNumberOfPrincipalComponents(unsigned int n);
00135 itkGetMacro(NumberOfPrincipalComponents, unsigned int);
00136
00138 itkSetObjectMacro(MeanImage, ImageType);
00139 itkGetObjectMacro(MeanImage, ImageType);
00140
00142 void SetPrincipalComponentImages(ImagePointerVector v)
00143 { m_PrincipalComponentImages = v; }
00144
00145
00146
00149 itkSetMacro(PrincipalComponentStandardDeviations, ParametersType);
00150 itkGetMacro(PrincipalComponentStandardDeviations, ParametersType);
00151
00153 itkSetObjectMacro(Transform, TransformType);
00154 itkGetObjectMacro(Transform, TransformType);
00155
00156
00158 virtual void SetParameters( const ParametersType & );
00159 virtual unsigned int GetNumberOfShapeParameters(void) const
00160 { return m_NumberOfPrincipalComponents; }
00161 virtual unsigned int GetNumberOfPoseParameters(void) const
00162 { return m_Transform ? m_Transform->GetNumberOfParameters() : 0; }
00163
00165 virtual OutputType Evaluate(const PointType& point) const;
00166
00169 virtual void Initialize() throw ( ExceptionObject );
00170
00171
00172 protected:
00173 PCAShapeSignedDistanceFunction();
00174 ~PCAShapeSignedDistanceFunction(){};
00175
00176 void PrintSelf(std::ostream& os, Indent indent) const;
00177
00178
00179 private:
00180 PCAShapeSignedDistanceFunction(const Self&);
00181 void operator=( const Self& );
00182
00183
00185 unsigned int m_NumberOfPrincipalComponents;
00186 unsigned int m_NumberOfTransformParameters;
00187
00188 ImagePointer m_MeanImage;
00189 ImagePointerVector m_PrincipalComponentImages;
00190 ParametersType m_PrincipalComponentStandardDeviations;
00191
00193 typename TransformType::Pointer m_Transform;
00194 InterpolatorPointerVector m_Interpolators;
00195 ExtrapolatorPointerVector m_Extrapolators;
00196 mutable FunctionPointerVector m_Selectors;
00197
00199 ParametersType m_WeightOfPrincipalComponents;
00200 ParametersType m_TransformParameters;
00201
00202 };
00203
00204 }
00205
00206 #ifndef ITK_MANUAL_INSTANTIATION
00207 #include "itkPCAShapeSignedDistanceFunction.txx"
00208 #endif
00209
00210 #endif