00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkShapePriorSegmentationLevelSetImageFilter_h_
00018 #define __itkShapePriorSegmentationLevelSetImageFilter_h_
00019
00020 #include "itkSegmentationLevelSetImageFilter.h"
00021 #include "itkShapePriorSegmentationLevelSetFunction.h"
00022 #include "itkSingleValuedNonLinearOptimizer.h"
00023 #include "itkShapePriorMAPCostFunctionBase.h"
00024
00025 namespace itk {
00026
00069 template <class TInputImage,
00070 class TFeatureImage,
00071 class TOutputPixelType = float >
00072 class ITK_EXPORT ShapePriorSegmentationLevelSetImageFilter
00073 : public SegmentationLevelSetImageFilter< TInputImage, TFeatureImage,
00074 TOutputPixelType>
00075 {
00076 public:
00077
00079 itkStaticConstMacro(ImageDimension, unsigned int,
00080 TInputImage::ImageDimension);
00081
00083 typedef ShapePriorSegmentationLevelSetImageFilter Self;
00084 typedef SegmentationLevelSetImageFilter<TInputImage, TFeatureImage, TOutputPixelType> Superclass;
00085 typedef SmartPointer<Self> Pointer;
00086 typedef SmartPointer<const Self> ConstPointer;
00087
00089 itkTypeMacro(ShapePriorSegmentationLevelSetImageFilter, SegmentationLevelSetImageFilter);
00090
00092 typedef typename Superclass::ValueType ValueType;
00093 typedef typename Superclass::OutputImageType OutputImageType;
00094 typedef typename Superclass::FeatureImageType FeatureImageType;
00095
00097 typedef TOutputPixelType OutputPixelType;
00098
00100 typedef ShapePriorSegmentationLevelSetFunction<OutputImageType, FeatureImageType>
00101 ShapePriorSegmentationFunctionType;
00102
00104 typedef typename ShapePriorSegmentationFunctionType::ShapeFunctionType
00105 ShapeFunctionType;
00106 typedef typename ShapeFunctionType::Pointer ShapeFunctionPointer;
00107
00109 typedef ShapePriorMAPCostFunctionBase<TFeatureImage,TOutputPixelType> CostFunctionType;
00110 typedef typename CostFunctionType::Pointer CostFunctionPointer;
00111 typedef typename CostFunctionType::ParametersType ParametersType;
00112
00114 typedef typename CostFunctionType::NodeType NodeType;
00115 typedef typename CostFunctionType::NodeContainerType NodeContainerType;
00116 typedef typename NodeContainerType::Pointer NodeContainerPointer;
00117
00119 typedef SingleValuedNonLinearOptimizer OptimizerType;
00120 typedef typename OptimizerType::Pointer OptimizerPointer;
00121
00123 virtual void SetShapeFunction(ShapeFunctionType *s);
00124 itkGetObjectMacro( ShapeFunction, ShapeFunctionType );
00125
00127 itkSetObjectMacro( CostFunction, CostFunctionType );
00128 itkGetObjectMacro( CostFunction, CostFunctionType );
00129
00131 itkSetObjectMacro( Optimizer, OptimizerType );
00132 itkGetObjectMacro( Optimizer, OptimizerType );
00133
00138 itkSetMacro( InitialParameters, ParametersType );
00139 itkGetMacro( InitialParameters, ParametersType );
00140
00142 void SetShapePriorScaling( ValueType v )
00143 {
00144 if ( v != m_ShapePriorSegmentationFunction->GetShapePriorWeight() )
00145 {
00146 m_ShapePriorSegmentationFunction->SetShapePriorWeight( v );
00147 this->Modified();
00148 }
00149 }
00150 ValueType GetShapePriorScaling() const
00151 {
00152 return m_ShapePriorSegmentationFunction->GetShapePriorWeight();
00153 }
00154
00157 virtual void SetShapePriorSegmentationFunction( ShapePriorSegmentationFunctionType * s );
00158 virtual ShapePriorSegmentationFunctionType * GetShapePriorSegmentationFunction()
00159 { return m_ShapePriorSegmentationFunction; }
00160
00162 itkGetConstReferenceMacro( CurrentParameters, ParametersType );
00163
00164 protected:
00165 virtual ~ShapePriorSegmentationLevelSetImageFilter() {}
00166 ShapePriorSegmentationLevelSetImageFilter();
00167
00168 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00169
00172 virtual void InitializeIteration();
00173
00176 void GenerateData();
00177
00179 void ExtractActiveRegion( NodeContainerType * ptr );
00180
00181 private:
00182
00183 ShapeFunctionPointer m_ShapeFunction;
00184 CostFunctionPointer m_CostFunction;
00185 OptimizerPointer m_Optimizer;
00186 ParametersType m_InitialParameters;
00187 ParametersType m_CurrentParameters;
00188
00189 ShapePriorSegmentationFunctionType * m_ShapePriorSegmentationFunction;
00190
00191 };
00192
00193 }
00194
00195 #ifndef ITK_MANUAL_INSTANTIATION
00196 #include "itkShapePriorSegmentationLevelSetImageFilter.txx"
00197 #endif
00198
00199 #endif
00200