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, Image<TOutputPixelType,
00075 ::itk::GetImageDimension<TInputImage>::ImageDimension> >
00076 {
00077 public:
00078
00080 itkStaticConstMacro(ImageDimension, unsigned int,
00081 TInputImage::ImageDimension);
00082
00084 typedef ShapePriorSegmentationLevelSetImageFilter Self;
00085 typedef SegmentationLevelSetImageFilter<TInputImage, TFeatureImage, TOutputPixelType,
00086 Image<TOutputPixelType, itkGetStaticConstMacro(ImageDimension)> > Superclass;
00087 typedef SmartPointer<Self> Pointer;
00088 typedef SmartPointer<const Self> ConstPointer;
00089
00091 itkTypeMacro(ShapePriorSegmentationLevelSetImageFilter, SegmentationLevelSetImageFilter);
00092
00094 typedef typename Superclass::ValueType ValueType;
00095 typedef typename Superclass::OutputImageType OutputImageType;
00096 typedef typename Superclass::FeatureImageType FeatureImageType;
00097
00099 typedef TOutputPixelType OutputPixelType;
00100
00102 typedef ShapePriorSegmentationLevelSetFunction<OutputImageType, FeatureImageType>
00103 ShapePriorSegmentationFunctionType;
00104
00106 typedef typename ShapePriorSegmentationFunctionType::ShapeFunctionType
00107 ShapeFunctionType;
00108 typedef typename ShapeFunctionType::Pointer ShapeFunctionPointer;
00109
00111 typedef ShapePriorMAPCostFunctionBase<TFeatureImage,TOutputPixelType> CostFunctionType;
00112 typedef typename CostFunctionType::Pointer CostFunctionPointer;
00113 typedef typename CostFunctionType::ParametersType ParametersType;
00114
00116 typedef typename CostFunctionType::NodeType NodeType;
00117 typedef typename CostFunctionType::NodeContainerType NodeContainerType;
00118 typedef typename NodeContainerType::Pointer NodeContainerPointer;
00119
00121 typedef SingleValuedNonLinearOptimizer OptimizerType;
00122 typedef typename OptimizerType::Pointer OptimizerPointer;
00123
00125 virtual void SetShapeFunction(ShapeFunctionType *s);
00126 itkGetObjectMacro( ShapeFunction, ShapeFunctionType );
00127
00129 itkSetObjectMacro( CostFunction, CostFunctionType );
00130 itkGetObjectMacro( CostFunction, CostFunctionType );
00131
00133 itkSetObjectMacro( Optimizer, OptimizerType );
00134 itkGetObjectMacro( Optimizer, OptimizerType );
00135
00140 itkSetMacro( InitialParameters, ParametersType );
00141 itkGetMacro( InitialParameters, ParametersType );
00142
00144 void SetShapePriorScaling( ValueType v )
00145 {
00146 if ( v != m_ShapePriorSegmentationFunction->GetShapePriorWeight() )
00147 {
00148 m_ShapePriorSegmentationFunction->SetShapePriorWeight( v );
00149 this->Modified();
00150 }
00151 }
00152 ValueType GetShapePriorScaling() const
00153 {
00154 return m_ShapePriorSegmentationFunction->GetShapePriorWeight();
00155 }
00156
00159 virtual void SetShapePriorSegmentationFunction( ShapePriorSegmentationFunctionType * s );
00160 virtual ShapePriorSegmentationFunctionType * GetShapePriorSegmentationFunction()
00161 { return m_ShapePriorSegmentationFunction; }
00162
00164 itkGetMacro( CurrentParameters, ParametersType );
00165
00166 protected:
00167 virtual ~ShapePriorSegmentationLevelSetImageFilter() {}
00168 ShapePriorSegmentationLevelSetImageFilter();
00169
00170 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00171
00174 virtual void InitializeIteration();
00175
00178 void GenerateData();
00179
00181 void ExtractActiveRegion( NodeContainerType * ptr );
00182
00183 private:
00184
00185 ShapeFunctionPointer m_ShapeFunction;
00186 CostFunctionPointer m_CostFunction;
00187 OptimizerPointer m_Optimizer;
00188 ParametersType m_InitialParameters;
00189 ParametersType m_CurrentParameters;
00190
00191 ShapePriorSegmentationFunctionType * m_ShapePriorSegmentationFunction;
00192
00193 };
00194
00195 }
00196
00197 #ifndef ITK_MANUAL_INSTANTIATION
00198 #include "itkShapePriorSegmentationLevelSetImageFilter.txx"
00199 #endif
00200
00201 #endif
00202