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
00137 itkSetMacro( InitialParameters, ParametersType );
00138 itkGetMacro( InitialParameters, ParametersType );
00139
00141 void SetShapePriorScaling( ValueType v )
00142 {
00143 if ( v != m_ShapePriorSegmentationFunction->GetShapePriorWeight() )
00144 {
00145 m_ShapePriorSegmentationFunction->SetShapePriorWeight( v );
00146 this->Modified();
00147 }
00148 }
00149 ValueType GetShapePriorScaling() const
00150 {
00151 return m_ShapePriorSegmentationFunction->GetShapePriorWeight();
00152 }
00153
00156 virtual void SetShapePriorSegmentationFunction( ShapePriorSegmentationFunctionType * s );
00157 virtual ShapePriorSegmentationFunctionType * GetShapePriorSegmentationFunction()
00158 { return m_ShapePriorSegmentationFunction; }
00159
00161 itkGetMacro( CurrentParameters, ParametersType );
00162
00163 protected:
00164 virtual ~ShapePriorSegmentationLevelSetImageFilter() {}
00165 ShapePriorSegmentationLevelSetImageFilter();
00166
00167 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00168
00171 virtual void InitializeIteration();
00172
00175 void GenerateData();
00176
00178 void ExtractActiveRegion( NodeContainerType * ptr );
00179
00180 private:
00181
00182 ShapeFunctionPointer m_ShapeFunction;
00183 CostFunctionPointer m_CostFunction;
00184 OptimizerPointer m_Optimizer;
00185 ParametersType m_InitialParameters;
00186 ParametersType m_CurrentParameters;
00187
00188 ShapePriorSegmentationFunctionType * m_ShapePriorSegmentationFunction;
00189
00190 };
00191
00192 }
00193
00194 #ifndef ITK_MANUAL_INSTANTIATION
00195 #include "itkShapePriorSegmentationLevelSetImageFilter.txx"
00196 #endif
00197
00198 #endif
00199