Go to the documentation of this file.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 #include "itkShapeSignedDistanceFunction.h"
00021 #include "itkImage.h"
00022 #include "itkInterpolateImageFunction.h"
00023 #include "itkExtrapolateImageFunction.h"
00024 #include "itkTransform.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 itkGetConstMacro(NumberOfPrincipalComponents, unsigned int);
00137
00139 itkSetObjectMacro(MeanImage, ImageType);
00140 itkGetObjectMacro(MeanImage, ImageType);
00142
00144 void SetPrincipalComponentImages(ImagePointerVector v)
00145 { m_PrincipalComponentImages = v; }
00146
00147
00149
00152 itkSetMacro(PrincipalComponentStandardDeviations, ParametersType);
00153 itkGetConstMacro(PrincipalComponentStandardDeviations, ParametersType);
00155
00157 itkSetObjectMacro(Transform, TransformType);
00158 itkGetObjectMacro(Transform, TransformType);
00160
00161
00163 virtual void SetParameters( const ParametersType & );
00164 virtual unsigned int GetNumberOfShapeParameters(void) const
00165 { return m_NumberOfPrincipalComponents; }
00166 virtual unsigned int GetNumberOfPoseParameters(void) const
00167 { return m_Transform ? m_Transform->GetNumberOfParameters() : 0; }
00169
00171 virtual OutputType Evaluate(const PointType& point) const;
00172
00175 virtual void Initialize() throw ( ExceptionObject );
00176
00177
00178 protected:
00179 PCAShapeSignedDistanceFunction();
00180 ~PCAShapeSignedDistanceFunction(){};
00181
00182 void PrintSelf(std::ostream& os, Indent indent) const;
00183
00184
00185 private:
00186 PCAShapeSignedDistanceFunction(const Self&);
00187 void operator=( const Self& );
00188
00189
00191 unsigned int m_NumberOfPrincipalComponents;
00192 unsigned int m_NumberOfTransformParameters;
00193
00194 ImagePointer m_MeanImage;
00195 ImagePointerVector m_PrincipalComponentImages;
00196 ParametersType m_PrincipalComponentStandardDeviations;
00197
00199 typename TransformType::Pointer m_Transform;
00200 InterpolatorPointerVector m_Interpolators;
00201 ExtrapolatorPointerVector m_Extrapolators;
00202 mutable FunctionPointerVector m_Selectors;
00203
00205 ParametersType m_WeightOfPrincipalComponents;
00206 ParametersType m_TransformParameters;
00207
00208 };
00209
00210 }
00211
00212
00213 #define ITK_TEMPLATE_PCAShapeSignedDistanceFunction(_, EXPORT, x, y) namespace itk { \
00214 _(3(class EXPORT PCAShapeSignedDistanceFunction< ITK_TEMPLATE_3 x >)) \
00215 namespace Templates { typedef PCAShapeSignedDistanceFunction< ITK_TEMPLATE_3 x > \
00216 PCAShapeSignedDistanceFunction##y; } \
00217 }
00218
00219 #if ITK_TEMPLATE_EXPLICIT
00220 # include "Templates/itkPCAShapeSignedDistanceFunction+-.h"
00221 #endif
00222
00223 #if ITK_TEMPLATE_TXX
00224 # include "itkPCAShapeSignedDistanceFunction.txx"
00225 #endif
00226
00227 #endif
00228