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 );
00097
00099 itkSetConstObjectMacro( ActiveRegion, NodeContainerType );
00100 itkGetConstObjectMacro( ActiveRegion, NodeContainerType );
00101
00103 itkSetConstObjectMacro( FeatureImage, FeatureImageType );
00104 itkGetConstObjectMacro( FeatureImage, FeatureImageType );
00105
00108 virtual MeasureType GetValue( const ParametersType & parameters ) const;
00109
00110
00113 virtual void GetDerivative( const ParametersType &, DerivativeType & ) const
00114 { itkExceptionMacro( << "This function is currently not supported." ); }
00115
00117 virtual unsigned int GetNumberOfParameters(void) const
00118 { return m_ShapeFunction->GetNumberOfParameters(); }
00119
00120
00123 virtual MeasureType ComputeLogInsideTerm( const ParametersType & ) const = 0;
00124
00127 virtual MeasureType ComputeLogGradientTerm( const ParametersType & ) const = 0;
00128
00131 virtual MeasureType ComputeLogShapePriorTerm( const ParametersType & ) const = 0;
00132
00135 virtual MeasureType ComputeLogPosePriorTerm( const ParametersType & ) const = 0;
00136
00139 virtual void Initialize(void) throw ( ExceptionObject );
00140
00141
00142 protected:
00143 ShapePriorMAPCostFunctionBase();
00144 virtual ~ShapePriorMAPCostFunctionBase() {};
00145
00146 void PrintSelf(std::ostream& os, Indent indent) const;
00147
00148 ShapeFunctionPointer m_ShapeFunction;
00149 NodeContainerPointer m_ActiveRegion;
00150 FeatureImagePointer m_FeatureImage;
00151
00152 private:
00153 ShapePriorMAPCostFunctionBase(const Self&);
00154 void operator=(const Self&);
00155
00156 };
00157
00158
00159 }
00160
00161
00162 #ifndef ITK_MANUAL_INSTANTIATION
00163 #include "itkShapePriorMAPCostFunctionBase.txx"
00164 #endif
00165
00166 #endif
00167
00168
00169