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 );
00126
00128 itkSetObjectMacro( CostFunction, CostFunctionType );
00129 itkGetObjectMacro( CostFunction, CostFunctionType );
00131
00133 itkSetObjectMacro( Optimizer, OptimizerType );
00134 itkGetObjectMacro( Optimizer, OptimizerType );
00136
00141 itkSetMacro( InitialParameters, ParametersType );
00142 itkGetMacro( InitialParameters, ParametersType );
00144
00146 void SetShapePriorScaling( ValueType v )
00147 {
00148 if ( v != m_ShapePriorSegmentationFunction->GetShapePriorWeight() )
00149 {
00150 m_ShapePriorSegmentationFunction->SetShapePriorWeight( v );
00151 this->Modified();
00152 }
00153 }
00154 ValueType GetShapePriorScaling() const
00155 {
00156 return m_ShapePriorSegmentationFunction->GetShapePriorWeight();
00157 }
00159
00162 virtual void SetShapePriorSegmentationFunction( ShapePriorSegmentationFunctionType * s );
00163 virtual ShapePriorSegmentationFunctionType * GetShapePriorSegmentationFunction()
00164 { return m_ShapePriorSegmentationFunction; }
00166
00168 itkGetConstReferenceMacro( CurrentParameters, ParametersType );
00169
00170 protected:
00171 virtual ~ShapePriorSegmentationLevelSetImageFilter() {}
00172 ShapePriorSegmentationLevelSetImageFilter();
00173
00174 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00175
00178 virtual void InitializeIteration();
00179
00182 void GenerateData();
00183
00185 void ExtractActiveRegion( NodeContainerType * ptr );
00186
00187 private:
00188 ShapePriorSegmentationLevelSetImageFilter(const Self&);
00189 void operator=(const Self&);
00190
00191 ShapeFunctionPointer m_ShapeFunction;
00192 CostFunctionPointer m_CostFunction;
00193 OptimizerPointer m_Optimizer;
00194 ParametersType m_InitialParameters;
00195 ParametersType m_CurrentParameters;
00196
00197 ShapePriorSegmentationFunctionType * m_ShapePriorSegmentationFunction;
00198
00199 };
00200
00201 }
00202
00203 #ifndef ITK_MANUAL_INSTANTIATION
00204 #include "itkShapePriorSegmentationLevelSetImageFilter.txx"
00205 #endif
00206
00207 #endif
00208
00209