Orfeo Toolbox  3.16
itkSegmentationLevelSetImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkSegmentationLevelSetImageFilter.h,v $
5  Language: C++
6  Date: $Date: 2009-04-23 03:53:37 $
7  Version: $Revision: 1.36 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkSegmentationLevelSetImageFilter_h
18 #define __itkSegmentationLevelSetImageFilter_h
19 
22 
23 namespace itk {
24 
139 template <class TInputImage,
140  class TFeatureImage,
141  class TOutputPixelType = float >
143  : public SparseFieldLevelSetImageFilter<TInputImage, Image<TOutputPixelType,
144  ::itk::GetImageDimension<TInputImage>::ImageDimension> >
145 {
146 public:
150 
153  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
154 
157 
163 
169 
171  typedef TFeatureImage FeatureImageType;
172 
176 
180 
183 
186  void SetMaximumIterations (unsigned int i)
187  {
188  itkWarningMacro("SetMaximumIterations is deprecated. Please use SetNumberOfIterations instead.");
189  this->SetNumberOfIterations(i);
190  }
191  unsigned int GetMaximumIterations()
192  {
193  itkWarningMacro("GetMaximumIterations is deprecated. Please use GetNumberOfIterations instead.");
194  return this->GetNumberOfIterations();
195  }
196 
199  virtual void SetFeatureImage(const FeatureImageType *f)
200  {
201  this->ProcessObject::SetNthInput( 1, const_cast< FeatureImageType * >(f) );
202  m_SegmentationFunction->SetFeatureImage(f);
203  }
204  virtual FeatureImageType * GetFeatureImage()
205  { return ( static_cast< FeatureImageType *>(this->ProcessObject::GetInput(1)) ); }
206 
209  virtual void SetInitialImage(InputImageType *f)
210  {
211  this->SetInput(f);
212  }
213 
215  void SetInput2(const FeatureImageType *input)
216  {
217  this->SetFeatureImage( input );
218  }
219 
223  void SetSpeedImage( SpeedImageType *s )
224  { m_SegmentationFunction->SetSpeedImage( s ); }
225 
229  void SetAdvectionImage( VectorImageType *v)
230  { m_SegmentationFunction->SetAdvectionImage( v ); }
231 
234  virtual const SpeedImageType *GetSpeedImage() const
235  { return m_SegmentationFunction->GetSpeedImage(); }
236 
239  virtual const VectorImageType *GetAdvectionImage() const
240  { return m_SegmentationFunction->GetAdvectionImage(); }
241 
245  void SetUseNegativeFeaturesOn()
246  {
247  itkWarningMacro( << "SetUseNegativeFeaturesOn has been deprecated. Please use ReverseExpansionDirectionOn() instead" );
248  this->ReverseExpansionDirectionOn();
249  }
250  void SetUseNegativeFeaturesOff()
251  {
252  itkWarningMacro( << "SetUseNegativeFeaturesOff has been deprecated. Please use ReverseExpansionDirectionOff() instead" );
253  this->ReverseExpansionDirectionOff();
254  }
255 
258  void SetUseNegativeFeatures( bool u )
259  {
260  itkWarningMacro( << "SetUseNegativeFeatures has been deprecated. Please use SetReverseExpansionDirection instead" );
261  if (u == true)
262  {
263  this->SetReverseExpansionDirection(false);
264  }
265  else
266  {
267  this->SetReverseExpansionDirection(true);
268  }
269  }
270  bool GetUseNegativeFeatures() const
271  {
272  itkWarningMacro( << "GetUseNegativeFeatures has been deprecated. Please use GetReverseExpansionDirection() instead" );
273  if ( m_ReverseExpansionDirection == false)
274  {
275  return true;
276  }
277  else
278  {
279  return false;
280  }
281  }
282 
291  itkSetMacro(ReverseExpansionDirection, bool);
292  itkGetConstMacro(ReverseExpansionDirection, bool);
293  itkBooleanMacro(ReverseExpansionDirection);
294 
300  itkSetMacro(AutoGenerateSpeedAdvection, bool);
301  itkGetConstMacro(AutoGenerateSpeedAdvection, bool);
302  itkBooleanMacro(AutoGenerateSpeedAdvection);
303 
308  void SetFeatureScaling(ValueType v)
309  {
310  if (v != m_SegmentationFunction->GetPropagationWeight())
311  {
312  this->SetPropagationScaling(v);
313  }
314  if (v != m_SegmentationFunction->GetAdvectionWeight())
315  {
316  this->SetAdvectionScaling(v);
317  }
318  }
319 
322  void SetPropagationScaling(ValueType v)
323  {
324  if (v != m_SegmentationFunction->GetPropagationWeight())
325  {
326  m_SegmentationFunction->SetPropagationWeight(v);
327  this->Modified();
328  }
329  }
330  ValueType GetPropagationScaling() const
331  {
332  return m_SegmentationFunction->GetPropagationWeight();
333  }
334 
337  void SetAdvectionScaling(ValueType v)
338  {
339  if (v != m_SegmentationFunction->GetAdvectionWeight())
340  {
341  m_SegmentationFunction->SetAdvectionWeight(v);
342  this->Modified();
343  }
344  }
345  ValueType GetAdvectionScaling() const
346  {
347  return m_SegmentationFunction->GetAdvectionWeight();
348  }
349 
354  void SetCurvatureScaling(ValueType v)
355  {
356  if (v != m_SegmentationFunction->GetCurvatureWeight())
357  {
358  m_SegmentationFunction->SetCurvatureWeight(v);
359  this->Modified();
360  }
361  }
362  ValueType GetCurvatureScaling() const
363  {
364  return m_SegmentationFunction->GetCurvatureWeight();
365  }
366 
368  void SetUseMinimalCurvature( bool b )
369  {
370  if ( m_SegmentationFunction->GetUseMinimalCurvature() != b)
371  {
372  m_SegmentationFunction->SetUseMinimalCurvature( b );
373  this->Modified();
374  }
375  }
376  bool GetUseMinimalCurvature() const
377  {
378  return m_SegmentationFunction->GetUseMinimalCurvature();
379  }
380  void UseMinimalCurvatureOn()
381  {
382  this->SetUseMinimalCurvature(true);
383  }
384  void UseMinimalCurvatureOff()
385  {
386  this->SetUseMinimalCurvature(false);
387  }
388 
389 
395  virtual void SetSegmentationFunction(SegmentationFunctionType *s)
396  {
397  m_SegmentationFunction = s;
398 
400  r.Fill( 1 );
401 
402  m_SegmentationFunction->Initialize(r);
403  this->SetDifferenceFunction(m_SegmentationFunction);
404  this->Modified();
405  }
406 
407  virtual SegmentationFunctionType *GetSegmentationFunction()
408  { return m_SegmentationFunction; }
409 
410 
415  void SetMaximumCurvatureTimeStep(double n)
416  {
417  if ( n != m_SegmentationFunction->GetMaximumCurvatureTimeStep() )
418  {
419  m_SegmentationFunction->SetMaximumCurvatureTimeStep(n);
420  this->Modified();
421  }
422  }
423  double GetMaximumCurvatureTimeStep() const
424  {
425  return m_SegmentationFunction->GetMaximumCurvatureTimeStep();
426  }
427 
432  void SetMaximumPropagationTimeStep(double n)
433  {
434  if (n != m_SegmentationFunction->GetMaximumPropagationTimeStep() )
435  {
436  m_SegmentationFunction->SetMaximumPropagationTimeStep(n);
437  this->Modified();
438  }
439  }
440  double GetMaximumPropagationTimeStep() const
441  {
442  return m_SegmentationFunction->GetMaximumPropagationTimeStep();
443  }
444 
448  void GenerateSpeedImage();
449 
453  void GenerateAdvectionImage();
454 
455 #ifdef ITK_USE_CONCEPT_CHECKING
456 
457  itkConceptMacro(OutputHasNumericTraitsCheck,
460 #endif
461 
462 protected:
465 
466  virtual void PrintSelf(std::ostream& os, Indent indent) const;
467 
469  virtual void InitializeIteration()
470  {
471  Superclass::InitializeIteration();
472  // Estimate the progress of the filter
473  this->SetProgress( (float) ((float)this->GetElapsedIterations()
474  / (float)this->GetNumberOfIterations()) );
475  }
476 
479  void GenerateData();
480 
484 
490 
491 private:
492  SegmentationLevelSetImageFilter(const Self&); //purposely not implemented
493  void operator=(const Self&); //purposely not implemented
494 
496 };
497 
498 } // end namespace itk
499 
500 #ifndef ITK_MANUAL_INSTANTIATION
502 #endif
503 
504 #endif

Generated at Sun Feb 3 2013 00:05:28 for Orfeo Toolbox with doxygen 1.8.1.1