ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkSegmentationLevelSetImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkSegmentationLevelSetImageFilter_h
19 #define itkSegmentationLevelSetImageFilter_h
20 
23 #include "itkMath.h"
24 
25 namespace itk
26 {
143 template< typename TInputImage,
144  typename TFeatureImage,
145  typename TOutputPixelType = float >
147  public SparseFieldLevelSetImageFilter< TInputImage, Image< TOutputPixelType,
148  TInputImage::ImageDimension > >
149 {
150 public:
151 
154 
155  //itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
156 
159 
164 
170 
172  typedef TFeatureImage FeatureImageType;
173 
177 
181 
184 
187  void SetMaximumIterations(unsigned int i)
188  {
189  itkWarningMacro("SetMaximumIterations is deprecated. Please use SetNumberOfIterations instead.");
190  this->SetNumberOfIterations(i);
191  }
193 
194  unsigned int GetMaximumIterations()
195  {
196  itkWarningMacro("GetMaximumIterations is deprecated. Please use GetNumberOfIterations instead.");
197  return this->GetNumberOfIterations();
198  }
199 
202  virtual void SetFeatureImage(const FeatureImageType *f)
203  {
204  this->ProcessObject::SetNthInput( 1, const_cast< FeatureImageType * >( f ) );
206  }
208 
210  { return ( static_cast< FeatureImageType * >( this->ProcessObject::GetInput(1) ) ); }
211 
215  {
216  this->SetInput(f);
217  }
218 
220  void SetInput2(const FeatureImageType *input)
221  {
222  this->SetFeatureImage(input);
223  }
224 
230 
236 
239  virtual const SpeedImageType * GetSpeedImage() const
241 
244  virtual const VectorImageType * GetAdvectionImage() const
246 
251  {
252  itkWarningMacro(
253  << "SetUseNegativeFeaturesOn has been deprecated. Please use ReverseExpansionDirectionOn() instead");
255  }
257 
259  {
260  itkWarningMacro(
261  << "SetUseNegativeFeaturesOff has been deprecated. Please use ReverseExpansionDirectionOff() instead");
263  }
264 
268  {
269  itkWarningMacro(<< "SetUseNegativeFeatures has been deprecated. Please use SetReverseExpansionDirection instead");
270  if ( u == true )
271  {
272  this->SetReverseExpansionDirection(false);
273  }
274  else
275  {
276  this->SetReverseExpansionDirection(true);
277  }
278  }
280 
282  {
283  itkWarningMacro(<< "GetUseNegativeFeatures has been deprecated. Please use GetReverseExpansionDirection() instead");
284  if ( m_ReverseExpansionDirection == false )
285  {
286  return true;
287  }
288  else
289  {
290  return false;
291  }
292  }
293 
302  itkSetMacro(ReverseExpansionDirection, bool);
303  itkGetConstMacro(ReverseExpansionDirection, bool);
304  itkBooleanMacro(ReverseExpansionDirection);
306 
312  itkSetMacro(AutoGenerateSpeedAdvection, bool);
313  itkGetConstMacro(AutoGenerateSpeedAdvection, bool);
314  itkBooleanMacro(AutoGenerateSpeedAdvection);
316 
322  {
324  {
325  this->SetPropagationScaling(v);
326  }
328  {
329  this->SetAdvectionScaling(v);
330  }
331  }
333 
337  {
339  {
341  this->Modified();
342  }
343  }
345 
347  {
349  }
350 
354  {
356  {
358  this->Modified();
359  }
360  }
362 
364  {
366  }
367 
373  {
375  {
377  this->Modified();
378  }
379  }
381 
383  {
385  }
386 
389  {
391  {
393  this->Modified();
394  }
395  }
397 
399  {
401  }
402 
404  {
405  this->SetUseMinimalCurvature(true);
406  }
407 
409  {
410  this->SetUseMinimalCurvature(false);
411  }
412 
419  {
421 
423  r.Fill(1);
424 
427  this->Modified();
428  }
429 
431  { return m_SegmentationFunction; }
432 
438  {
440  {
442  this->Modified();
443  }
444  }
446 
448  {
450  }
451 
457  {
459  {
461  this->Modified();
462  }
463  }
465 
467  {
469  }
470 
474  void GenerateSpeedImage();
475 
479  void GenerateAdvectionImage();
480 
481 #ifdef ITK_USE_CONCEPT_CHECKING
482  // Begin concept checking
483  itkConceptMacro( OutputHasNumericTraitsCheck,
485  // End concept checking
486 #endif
487 
488 protected:
491 
492  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
493 
495  virtual void InitializeIteration() ITK_OVERRIDE
496  {
498  // Estimate the progress of the filter
499  this->UpdateProgress( (float)( (float)this->GetElapsedIterations()
500  / (float)this->GetNumberOfIterations() ) );
501  }
503 
506  void GenerateData() ITK_OVERRIDE;
507 
511 
517 
518 private:
519  SegmentationLevelSetImageFilter(const Self &) ITK_DELETE_FUNCTION;
520  void operator=(const Self &) ITK_DELETE_FUNCTION;
521 
523 };
524 } // end namespace itk
525 
526 #ifndef ITK_MANUAL_INSTANTIATION
527 #include "itkSegmentationLevelSetImageFilter.hxx"
528 #endif
529 
530 #endif
static void SetMaximumCurvatureTimeStep(double n)
void SetSpeedImage(ImageType *s)
Light weight base class for most itk classes.
virtual void SetReverseExpansionDirection(bool _arg)
SegmentationFunctionType::VectorImageType VectorImageType
virtual void SetFeatureImage(const FeatureImageType *f)
static double GetMaximumCurvatureTimeStep()
SegmentationLevelSetFunction< OutputImageType, FeatureImageType > SegmentationFunctionType
This class implements a finite difference partial differential equation solver for evolving surfaces ...
bool GetUseMinimalCurvature() const
SparseFieldLevelSetImageFilter< TInputImage, OutputImageType > Superclass
static double GetMaximumPropagationTimeStep()
void SetAdvectionImage(VectorImageType *s)
virtual void SetPropagationWeight(const ScalarValueType p)
virtual void PrintSelf(std::ostream &os, Indent indent) const override
void UpdateProgress(float progress)
Update the progress of the process object.
virtual void SetSegmentationFunction(SegmentationFunctionType *s)
Image< TOutputPixelType, itkGetStaticConstMacro(InputImageDimension) > OutputImageType
virtual const SpeedImageType * GetSpeedImage() const
SegmentationFunctionType::ImageType SpeedImageType
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Definition: itkMath.h:676
virtual void Modified() const
virtual SegmentationFunctionType * GetSegmentationFunction()
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
virtual void SetFeatureImage(const FeatureImageType *f)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
ScalarValueType GetAdvectionWeight() const
virtual void Initialize(const RadiusType &r) override
virtual void SetNthInput(DataObjectPointerArraySizeType num, DataObject *input)
virtual void SetCurvatureWeight(const ScalarValueType c)
virtual void SetAdvectionWeight(const ScalarValueType a)
virtual VectorImageType * GetAdvectionImage() const
ScalarValueType GetCurvatureWeight() const
#define itkConceptMacro(name, concept)
virtual const VectorImageType * GetAdvectionImage() const
static void SetMaximumPropagationTimeStep(double n)
void SetUseMinimalCurvature(bool b)
A base class which defines the API for implementing a special class of image segmentation filters usi...
Templated n-dimensional image class.
Definition: itkImage.h:75
ScalarValueType GetPropagationWeight() const