00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkShapePriorMAPCostFunctionBase_h
00018 #define __itkShapePriorMAPCostFunctionBase_h
00019
00020 #include "itkSingleValuedCostFunction.h"
00021 #include "itkLevelSet.h"
00022 #include "itkShapeSignedDistanceFunction.h"
00023
00024 namespace itk
00025 {
00026
00046 template <class TFeatureImage, class TOutputPixel>
00047 class ITK_EXPORT ShapePriorMAPCostFunctionBase :
00048 public SingleValuedCostFunction
00049 {
00050 public:
00052 typedef ShapePriorMAPCostFunctionBase Self;
00053 typedef SingleValuedCostFunction Superclass;
00054 typedef SmartPointer<Self> Pointer;
00055 typedef SmartPointer<const Self> ConstPointer;
00056
00058 itkTypeMacro( ShapePriorMAPCostFunctionBase, SingleValuedCostFunction );
00059
00062 typedef typename Superclass::MeasureType MeasureType;
00063
00066 typedef typename Superclass::DerivativeType DerivativeType;
00067
00070 typedef typename Superclass::ParametersType ParametersType;
00071
00073 typedef TFeatureImage FeatureImageType;
00074 typedef typename FeatureImageType::ConstPointer FeatureImagePointer;
00075
00077 itkStaticConstMacro( ImageDimension, unsigned int, TFeatureImage::ImageDimension);
00078
00080 typedef TOutputPixel PixelType;
00081
00083 typedef LevelSetNode<PixelType, itkGetStaticConstMacro(ImageDimension)> NodeType;
00084
00086 typedef VectorContainer<unsigned int, NodeType> NodeContainerType;
00087 typedef typename NodeContainerType::ConstPointer NodeContainerPointer;
00088
00090 typedef ShapeSignedDistanceFunction<double,
00091 itkGetStaticConstMacro(ImageDimension)> ShapeFunctionType;
00092 typedef typename ShapeFunctionType::Pointer ShapeFunctionPointer;
00093
00095 itkSetObjectMacro( ShapeFunction, ShapeFunctionType );
00096 itkGetObjectMacro( ShapeFunction, ShapeFunctionType );
00098
00100 itkSetConstObjectMacro( ActiveRegion, NodeContainerType );
00101 itkGetConstObjectMacro( ActiveRegion, NodeContainerType );
00103
00105 itkSetConstObjectMacro( FeatureImage, FeatureImageType );
00106 itkGetConstObjectMacro( FeatureImage, FeatureImageType );
00108
00111 virtual MeasureType GetValue( const ParametersType & parameters ) const;
00112
00113
00116 virtual void GetDerivative( const ParametersType &, DerivativeType & ) const
00117 { itkExceptionMacro( << "This function is currently not supported." ); }
00118
00120 virtual unsigned int GetNumberOfParameters(void) const
00121 { return m_ShapeFunction->GetNumberOfParameters(); }
00122
00123
00126 virtual MeasureType ComputeLogInsideTerm( const ParametersType & ) const = 0;
00127
00130 virtual MeasureType ComputeLogGradientTerm( const ParametersType & ) const = 0;
00131
00134 virtual MeasureType ComputeLogShapePriorTerm( const ParametersType & ) const = 0;
00135
00138 virtual MeasureType ComputeLogPosePriorTerm( const ParametersType & ) const = 0;
00139
00142 virtual void Initialize(void) throw ( ExceptionObject );
00143
00144
00145 protected:
00146 ShapePriorMAPCostFunctionBase();
00147 virtual ~ShapePriorMAPCostFunctionBase() {};
00148
00149 void PrintSelf(std::ostream& os, Indent indent) const;
00150
00151 ShapeFunctionPointer m_ShapeFunction;
00152 NodeContainerPointer m_ActiveRegion;
00153 FeatureImagePointer m_FeatureImage;
00154
00155 private:
00156 ShapePriorMAPCostFunctionBase(const Self&);
00157 void operator=(const Self&);
00158
00159 };
00160
00161
00162 }
00163
00164
00165 #ifndef ITK_MANUAL_INSTANTIATION
00166 #include "itkShapePriorMAPCostFunctionBase.txx"
00167 #endif
00168
00169 #endif
00170