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
00040 template< typename TCoordRep,
00041 unsigned int VSpaceDimension,
00042 typename TImage = Image<double,VSpaceDimension> >
00043 class ITK_EXPORT PCAShapeSignedDistanceFunction :
00044 public ShapeSignedDistanceFunction<TCoordRep, VSpaceDimension>
00045 {
00046
00047 public:
00049 typedef PCAShapeSignedDistanceFunction Self;
00050 typedef ShapeSignedDistanceFunction<
00051 TCoordRep, VSpaceDimension> Superclass;
00052 typedef SmartPointer<Self> Pointer;
00053 typedef SmartPointer<const Self> ConstPointer;
00054
00055
00057 itkTypeMacro(PCAShapeSignedDistanceFunction, ShapeSignedDistancFunction);
00058
00060 itkNewMacro(Self);
00061
00063 itkStaticConstMacro(SpaceDimension,unsigned int,Superclass::SpaceDimension);
00064
00065
00067 typedef typename Superclass::CoordRepType CoordRepType;
00068
00070 typedef typename Superclass::InputType InputType;
00071
00073 typedef typename Superclass::OutputType OutputType;
00074
00076 typedef typename Superclass::PointType PointType;
00077
00079 typedef typename Superclass::ParametersType ParametersType;
00080
00081
00083 typedef TImage ImageType;
00084 typedef typename ImageType::Pointer ImagePointer;
00085 typedef std::vector<ImagePointer> ImagePointerVector;
00086
00088 typedef Transform<CoordRepType,
00089 itkGetStaticConstMacro(SpaceDimension),
00090 itkGetStaticConstMacro(SpaceDimension)> TransformType;
00091
00093 typedef InterpolateImageFunction<ImageType, CoordRepType> InterpolatorType;
00094 typedef typename InterpolatorType::Pointer InterpolatorPointer;
00095 typedef std::vector<InterpolatorPointer> InterpolatorPointerVector;
00096
00098 typedef ExtrapolateImageFunction<ImageType, CoordRepType> ExtrapolatorType;
00099 typedef typename ExtrapolatorType::Pointer ExtrapolatorPointer;
00100 typedef std::vector<ExtrapolatorPointer> ExtrapolatorPointerVector;
00101
00103 typedef ImageFunction<ImageType, double, CoordRepType> FunctionType;
00104 typedef typename FunctionType::Pointer FunctionPointer;
00105 typedef std::vector<FunctionPointer> FunctionPointerVector;
00106
00107
00110 void SetNumberOfPrincipalComponents(unsigned int n);
00111 itkGetMacro(NumberOfPrincipalComponents, unsigned int);
00112
00114 itkSetObjectMacro(MeanImage, ImageType);
00115 itkGetObjectMacro(MeanImage, ImageType);
00116
00118 void SetPrincipalComponentImages(ImagePointerVector v)
00119 { m_PrincipalComponentImages = v; }
00120
00121
00122
00124 itkSetMacro(PrincipalComponentStandardDeviations, ParametersType);
00125 itkGetMacro(PrincipalComponentStandardDeviations, ParametersType);
00126
00128 itkSetObjectMacro(Transform, TransformType);
00129 itkGetObjectMacro(Transform, TransformType);
00130
00131
00133 virtual void SetParameters( const ParametersType & );
00134 virtual const ParametersType& GetParameters(void) const
00135 { return m_Parameters; }
00136 virtual unsigned int GetNumberOfShapeParameters(void) const
00137 { return m_NumberOfPrincipalComponents; }
00138 virtual unsigned int GetNumberOfPoseParameters(void) const
00139 { return m_Transform ? m_Transform->GetNumberOfParameters() : 0; }
00140
00142 virtual OutputType Evaluate(const PointType& point) const;
00143
00146 virtual void Initialize() throw ( ExceptionObject );
00147
00148
00149 protected:
00150 PCAShapeSignedDistanceFunction();
00151 ~PCAShapeSignedDistanceFunction(){};
00152
00153 void PrintSelf(std::ostream& os, Indent indent) const;
00154
00155
00156 private:
00157 PCAShapeSignedDistanceFunction(const Self&);
00158 void operator=( const Self& );
00159
00160
00162 unsigned int m_NumberOfPrincipalComponents;
00163 unsigned int m_NumberOfTransformParameters;
00164
00165 ImagePointer m_MeanImage;
00166 ImagePointerVector m_PrincipalComponentImages;
00167 ParametersType m_PrincipalComponentStandardDeviations;
00168
00170 typename TransformType::Pointer m_Transform;
00171 InterpolatorPointerVector m_Interpolators;
00172 ExtrapolatorPointerVector m_Extrapolators;
00173 mutable FunctionPointerVector m_Selectors;
00174
00176 ParametersType m_WeightOfPrincipalComponents;
00177 ParametersType m_TransformParameters;
00178
00179 };
00180
00181 }
00182
00183 #ifndef ITK_MANUAL_INSTANTIATION
00184 #include "itkPCAShapeSignedDistanceFunction.txx"
00185 #endif
00186
00187 #endif