00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkSegmentationLevelSetImageFilter_h_
00018 #define __itkSegmentationLevelSetImageFilter_h_
00019
00020 #include "itkSparseFieldLevelSetImageFilter.h"
00021 #include "itkSegmentationLevelSetFunction.h"
00022
00023 namespace itk {
00024
00132 template <class TInputImage,
00133 class TFeatureImage,
00134 class TOutputPixelType = float,
00135 class TOutputImage = Image<TOutputPixelType,
00136 ::itk::GetImageDimension<TInputImage>::ImageDimension> >
00137 class ITK_EXPORT SegmentationLevelSetImageFilter
00138 : public SparseFieldLevelSetImageFilter<TInputImage, TOutputImage>
00139 {
00140 public:
00142 typedef SegmentationLevelSetImageFilter Self;
00143 typedef SparseFieldLevelSetImageFilter<TInputImage, TOutputImage> Superclass;
00144 typedef SmartPointer<Self> Pointer;
00145 typedef SmartPointer<const Self> ConstPointer;
00146
00148 typedef typename Superclass::ValueType ValueType;
00149 typedef typename Superclass::IndexType IndexType;
00150 typedef typename Superclass::TimeStepType TimeStepType;
00151 typedef typename Superclass::InputImageType InputImageType;
00152
00154 typedef TOutputImage OutputImageType;
00155 typedef TFeatureImage FeatureImageType;
00156
00158 typedef SegmentationLevelSetFunction<OutputImageType, FeatureImageType>
00159 SegmentationFunctionType;
00160
00162 typedef typename SegmentationFunctionType::VectorImageType VectorImageType;
00163
00165 itkTypeMacro(SegmentationLevelSetImageFilter, SparseFieldLevelSetImageFilter);
00166
00169 itkSetMacro(MaximumRMSError, ValueType);
00170 itkGetMacro(MaximumRMSError, ValueType);
00171
00174 itkSetMacro(MaximumIterations, unsigned int);
00175 itkGetMacro(MaximumIterations, unsigned int);
00176
00179 virtual void SetFeatureImage(FeatureImageType *f)
00180 {
00181 this->ProcessObject::SetNthInput( 1, const_cast< FeatureImageType * >(f) );
00182 m_SegmentationFunction->SetFeatureImage(f);
00183 }
00184 virtual FeatureImageType * GetFeatureImage()
00185 { return ( static_cast< FeatureImageType *>(this->ProcessObject::GetInput(1)) ); }
00186
00189 virtual void SetInitialImage(InputImageType *f)
00190 {
00191 this->SetInput(f);
00192 }
00193
00194 virtual typename SegmentationFunctionType::ImageType *GetSpeedImage() const
00195 { return m_SegmentationFunction->GetSpeedImage(); }
00196
00197 virtual typename SegmentationFunctionType::VectorImageType *GetAdvectionImage() const
00198 { return m_SegmentationFunction->GetAdvectionImage(); }
00199
00202 void SetUseNegativeFeaturesOn()
00203 {
00204 this->SetUseNegativeFeatures(true);
00205 }
00206 void SetUseNegativeFeaturesOff()
00207 {
00208 this->SetUseNegativeFeatures(false);
00209 }
00210
00215 itkSetMacro(UseNegativeFeatures, bool);
00216 itkGetMacro(UseNegativeFeatures, bool);
00217
00222 void SetFeatureScaling(ValueType v)
00223 {
00224 this->SetPropagationScaling(v);
00225 this->SetAdvectionScaling(v);
00226 }
00227
00230 itkSetMacro(PropagationScaling, ValueType);
00231 itkGetMacro(PropagationScaling, ValueType);
00232
00235 itkSetMacro(AdvectionScaling, ValueType);
00236 itkGetMacro(AdvectionScaling, ValueType);
00237
00241 itkSetMacro(CurvatureScaling, ValueType);
00242 itkGetMacro(CurvatureScaling, ValueType);
00243
00246 virtual void SetSegmentationFunction(SegmentationFunctionType *s);
00247 virtual SegmentationFunctionType *GetSegmentationFunction()
00248 { return m_SegmentationFunction; }
00249
00250 protected:
00251 virtual ~SegmentationLevelSetImageFilter() {}
00252 SegmentationLevelSetImageFilter();
00253
00254 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00255
00257 virtual void InitializeIteration()
00258 {
00259 Superclass::InitializeIteration();
00260
00261 this->SetProgress( (float) ((float)this->GetElapsedIterations()
00262 / (float)this->GetMaximumIterations()) );
00263 }
00264
00267 void GenerateData();
00268
00271 bool Halt();
00272
00274 bool m_UseNegativeFeatures;
00275
00277 ValueType m_CurvatureScaling;
00278
00280 ValueType m_PropagationScaling;
00281
00283 ValueType m_AdvectionScaling;
00284
00285 private:
00286 unsigned int m_MaximumIterations;
00287 SegmentationFunctionType *m_SegmentationFunction;
00288 ValueType m_MaximumRMSError;
00289
00290 };
00291
00292 }
00293
00294 #ifndef ITK_MANUAL_INSTANTIATION
00295 #include "itkSegmentationLevelSetImageFilter.txx"
00296 #endif
00297
00298 #endif
00299