ITK  4.8.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 
24 namespace itk
25 {
142 template< typename TInputImage,
143  typename TFeatureImage,
144  typename TOutputPixelType = float >
146  public SparseFieldLevelSetImageFilter< TInputImage, Image< TOutputPixelType,
147  TInputImage::ImageDimension > >
148 {
149 public:
150 
153 
154  //itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
155 
158 
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  }
192 
193  unsigned int GetMaximumIterations()
194  {
195  itkWarningMacro("GetMaximumIterations is deprecated. Please use GetNumberOfIterations instead.");
196  return this->GetNumberOfIterations();
197  }
198 
201  virtual void SetFeatureImage(const FeatureImageType *f)
202  {
203  this->ProcessObject::SetNthInput( 1, const_cast< FeatureImageType * >( f ) );
205  }
207 
209  { return ( static_cast< FeatureImageType * >( this->ProcessObject::GetInput(1) ) ); }
210 
214  {
215  this->SetInput(f);
216  }
217 
219  void SetInput2(const FeatureImageType *input)
220  {
221  this->SetFeatureImage(input);
222  }
223 
229 
235 
238  virtual const SpeedImageType * GetSpeedImage() const
240 
243  virtual const VectorImageType * GetAdvectionImage() const
245 
250  {
251  itkWarningMacro(
252  << "SetUseNegativeFeaturesOn has been deprecated. Please use ReverseExpansionDirectionOn() instead");
254  }
256 
258  {
259  itkWarningMacro(
260  << "SetUseNegativeFeaturesOff has been deprecated. Please use ReverseExpansionDirectionOff() instead");
262  }
263 
267  {
268  itkWarningMacro(<< "SetUseNegativeFeatures has been deprecated. Please use SetReverseExpansionDirection instead");
269  if ( u == true )
270  {
271  this->SetReverseExpansionDirection(false);
272  }
273  else
274  {
275  this->SetReverseExpansionDirection(true);
276  }
277  }
279 
281  {
282  itkWarningMacro(<< "GetUseNegativeFeatures has been deprecated. Please use GetReverseExpansionDirection() instead");
283  if ( m_ReverseExpansionDirection == false )
284  {
285  return true;
286  }
287  else
288  {
289  return false;
290  }
291  }
292 
301  itkSetMacro(ReverseExpansionDirection, bool);
302  itkGetConstMacro(ReverseExpansionDirection, bool);
303  itkBooleanMacro(ReverseExpansionDirection);
305 
311  itkSetMacro(AutoGenerateSpeedAdvection, bool);
312  itkGetConstMacro(AutoGenerateSpeedAdvection, bool);
313  itkBooleanMacro(AutoGenerateSpeedAdvection);
315 
321  {
323  {
324  this->SetPropagationScaling(v);
325  }
327  {
328  this->SetAdvectionScaling(v);
329  }
330  }
332 
336  {
338  {
340  this->Modified();
341  }
342  }
344 
346  {
348  }
349 
353  {
355  {
357  this->Modified();
358  }
359  }
361 
363  {
365  }
366 
372  {
374  {
376  this->Modified();
377  }
378  }
380 
382  {
384  }
385 
388  {
390  {
392  this->Modified();
393  }
394  }
396 
398  {
400  }
401 
403  {
404  this->SetUseMinimalCurvature(true);
405  }
406 
408  {
409  this->SetUseMinimalCurvature(false);
410  }
411 
418  {
420 
422  r.Fill(1);
423 
426  this->Modified();
427  }
428 
430  { return m_SegmentationFunction; }
431 
437  {
439  {
441  this->Modified();
442  }
443  }
445 
447  {
449  }
450 
456  {
458  {
460  this->Modified();
461  }
462  }
464 
466  {
468  }
469 
473  void GenerateSpeedImage();
474 
478  void GenerateAdvectionImage();
479 
480 #ifdef ITK_USE_CONCEPT_CHECKING
481  // Begin concept checking
482  itkConceptMacro( OutputHasNumericTraitsCheck,
484  // End concept checking
485 #endif
486 
487 protected:
490 
491  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
492 
494  virtual void InitializeIteration() ITK_OVERRIDE
495  {
497  // Estimate the progress of the filter
498  this->UpdateProgress( (float)( (float)this->GetElapsedIterations()
499  / (float)this->GetNumberOfIterations() ) );
500  }
502 
505  void GenerateData() ITK_OVERRIDE;
506 
510 
516 
517 private:
518  SegmentationLevelSetImageFilter(const Self &); //purposely not implemented
519  void operator=(const Self &); //purposely not implemented
520 
522 };
523 } // end namespace itk
524 
525 #ifndef ITK_MANUAL_INSTANTIATION
526 #include "itkSegmentationLevelSetImageFilter.hxx"
527 #endif
528 
529 #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
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