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 #include "itkTransform.h"
00026
00027 namespace itk
00028 {
00029
00030
00065 template< typename TCoordRep,
00066 unsigned int VSpaceDimension,
00067 typename TImage = Image<double,VSpaceDimension> >
00068 class ITK_EXPORT PCAShapeSignedDistanceFunction :
00069 public ShapeSignedDistanceFunction<TCoordRep, VSpaceDimension>
00070 {
00071
00072 public:
00074 typedef PCAShapeSignedDistanceFunction Self;
00075 typedef ShapeSignedDistanceFunction<
00076 TCoordRep, VSpaceDimension> Superclass;
00077 typedef SmartPointer<Self> Pointer;
00078 typedef SmartPointer<const Self> ConstPointer;
00079
00080
00082 itkTypeMacro(PCAShapeSignedDistanceFunction, ShapeSignedDistancFunction);
00083
00085 itkNewMacro(Self);
00086
00088 itkStaticConstMacro(SpaceDimension,unsigned int,Superclass::SpaceDimension);
00089
00090
00092 typedef typename Superclass::CoordRepType CoordRepType;
00093
00095 typedef typename Superclass::InputType InputType;
00096
00098 typedef typename Superclass::OutputType OutputType;
00099
00101 typedef typename Superclass::PointType PointType;
00102
00104 typedef typename Superclass::ParametersType ParametersType;
00105
00106
00108 typedef TImage ImageType;
00109 typedef typename ImageType::Pointer ImagePointer;
00110 typedef std::vector<ImagePointer> ImagePointerVector;
00111
00113 typedef Transform<CoordRepType,
00114 itkGetStaticConstMacro(SpaceDimension),
00115 itkGetStaticConstMacro(SpaceDimension)> TransformType;
00116
00118 typedef InterpolateImageFunction<ImageType, CoordRepType> InterpolatorType;
00119 typedef typename InterpolatorType::Pointer InterpolatorPointer;
00120 typedef std::vector<InterpolatorPointer> InterpolatorPointerVector;
00121
00123 typedef ExtrapolateImageFunction<ImageType, CoordRepType> ExtrapolatorType;
00124 typedef typename ExtrapolatorType::Pointer ExtrapolatorPointer;
00125 typedef std::vector<ExtrapolatorPointer> ExtrapolatorPointerVector;
00126
00128 typedef ImageFunction<ImageType, double, CoordRepType> FunctionType;
00129 typedef typename FunctionType::Pointer FunctionPointer;
00130 typedef std::vector<FunctionPointer> FunctionPointerVector;
00131
00132
00135 void SetNumberOfPrincipalComponents(unsigned int n);
00136 itkGetMacro(NumberOfPrincipalComponents, unsigned int);
00137
00139 itkSetObjectMacro(MeanImage, ImageType);
00140 itkGetObjectMacro(MeanImage, ImageType);
00141
00143 void SetPrincipalComponentImages(ImagePointerVector v)
00144 { m_PrincipalComponentImages = v; }
00145
00146
00147
00150 itkSetMacro(PrincipalComponentStandardDeviations, ParametersType);
00151 itkGetMacro(PrincipalComponentStandardDeviations, ParametersType);
00152
00154 itkSetObjectMacro(Transform, TransformType);
00155 itkGetObjectMacro(Transform, TransformType);
00156
00157
00159 virtual void SetParameters( const ParametersType & );
00160 virtual unsigned int GetNumberOfShapeParameters(void) const
00161 { return m_NumberOfPrincipalComponents; }
00162 virtual unsigned int GetNumberOfPoseParameters(void) const
00163 { return m_Transform ? m_Transform->GetNumberOfParameters() : 0; }
00164
00166 virtual OutputType Evaluate(const PointType& point) const;
00167
00170 virtual void Initialize() throw ( ExceptionObject );
00171
00172
00173 protected:
00174 PCAShapeSignedDistanceFunction();
00175 ~PCAShapeSignedDistanceFunction(){};
00176
00177 void PrintSelf(std::ostream& os, Indent indent) const;
00178
00179
00180 private:
00181 PCAShapeSignedDistanceFunction(const Self&);
00182 void operator=( const Self& );
00183
00184
00186 unsigned int m_NumberOfPrincipalComponents;
00187 unsigned int m_NumberOfTransformParameters;
00188
00189 ImagePointer m_MeanImage;
00190 ImagePointerVector m_PrincipalComponentImages;
00191 ParametersType m_PrincipalComponentStandardDeviations;
00192
00194 typename TransformType::Pointer m_Transform;
00195 InterpolatorPointerVector m_Interpolators;
00196 ExtrapolatorPointerVector m_Extrapolators;
00197 mutable FunctionPointerVector m_Selectors;
00198
00200 ParametersType m_WeightOfPrincipalComponents;
00201 ParametersType m_TransformParameters;
00202
00203 };
00204
00205 }
00206
00207 #ifndef ITK_MANUAL_INSTANTIATION
00208 #include "itkPCAShapeSignedDistanceFunction.txx"
00209 #endif
00210
00211 #endif