ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkNarrowBandLevelSetImageFilter.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 itkNarrowBandLevelSetImageFilter_h
19 #define itkNarrowBandLevelSetImageFilter_h
20 
25 #include "itkMath.h"
26 
27 namespace itk
28 {
143 template< typename TInputImage,
144  typename TFeatureImage,
145  typename TOutputPixelType = float,
146  typename TOutputImage = Image< TOutputPixelType,
147  TInputImage::ImageDimension > >
149  public NarrowBandImageFilterBase< TInputImage, TOutputImage >
150 {
151 public:
152 
158 
164 
166  typedef TOutputImage OutputImageType;
167  typedef TFeatureImage FeatureImageType;
168 
172 
175 
178 
181  virtual void SetFeatureImage(const FeatureImageType *f)
182  {
183  this->ProcessObject::SetNthInput( 1, const_cast< FeatureImageType * >( f ) );
185  }
187 
189  {
190  return ( static_cast< FeatureImageType * >( this->ProcessObject::GetInput(1) ) );
191  }
192 
196  {
197  this->SetInput(f);
198  }
199 
200  virtual const typename SegmentationFunctionType::ImageType * GetSpeedImage() const
202 
205 
210  {
211  itkWarningMacro(
212  << "SetUseNegativeFeaturesOn has been deprecated. Please use ReverseExpansionDirectionOn() instead");
214  }
216 
218  {
219  itkWarningMacro(
220  << "SetUseNegativeFeaturesOff has been deprecated. Please use ReverseExpansionDirectionOff() instead");
222  }
223 
227  {
228  itkWarningMacro(<< "SetUseNegativeFeatures has been deprecated. Please use SetReverseExpansionDirection instead");
229  if ( u == true )
230  {
231  this->SetReverseExpansionDirection(false);
232  }
233  else
234  {
235  this->SetReverseExpansionDirection(true);
236  }
237  }
239 
241  {
242  itkWarningMacro(<< "GetUseNegativeFeatures has been deprecated. Please use GetReverseExpansionDirection() instead");
243  if ( this->GetReverseExpansionDirection() == false )
244  {
245  return true;
246  }
247  else
248  {
249  return false;
250  }
251  }
252 
261  itkSetMacro(ReverseExpansionDirection, bool);
262  itkGetConstMacro(ReverseExpansionDirection, bool);
263  itkBooleanMacro(ReverseExpansionDirection);
265 
271  {
273  {
274  this->SetPropagationScaling(v);
275  }
277  {
278  this->SetAdvectionScaling(v);
279  }
280  }
282 
286  {
288  {
290  }
291  }
293 
295  {
297  }
298 
302  {
304  {
306  }
307  }
309 
311  {
313  }
314 
320  {
322  {
324  }
325  }
327 
329  {
331  }
332 
336 
338  { return m_SegmentationFunction; }
339 
342  void SetMaximumIterations(unsigned int i)
343  {
344  itkWarningMacro("SetMaximumIterations is deprecated. Please use SetNumberOfIterations instead.");
345  this->SetNumberOfIterations(i);
346  }
348 
349  unsigned int GetMaximumIterations()
350  {
351  itkWarningMacro("GetMaximumIterations is deprecated. Please use GetNumberOfIterations instead.");
352  return this->GetNumberOfIterations();
353  }
354 
355  virtual void SetMaximumRMSError(const double) ITK_OVERRIDE
356  {
357  itkWarningMacro(
358  "The current implmentation of this solver does not compute maximum RMS change. The maximum RMS error value will not be set or used.");
359  }
360 
361 #ifdef ITK_USE_CONCEPT_CHECKING
362  // Begin concept checking
363  itkConceptMacro( OutputHasNumericTraitsCheck,
365  // End concept checking
366 #endif
367 
368 protected:
371  NarrowBandLevelSetImageFilter(const Self &) ITK_DELETE_FUNCTION;
372 
373  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
374 
375  void operator=(const Self &) ITK_DELETE_FUNCTION;
376 
378  virtual void InitializeIteration() ITK_OVERRIDE
379  {
381  // Estimate the progress of the filter
382  this->UpdateProgress( (float)( (float)this->GetElapsedIterations()
383  / (float)this->GetNumberOfIterations() ) );
384  }
386 
390  virtual void CreateNarrowBand() ITK_OVERRIDE;
391 
394  void GenerateData() ITK_OVERRIDE;
395 
399 
405  typedef FastChamferDistanceImageFilter< OutputImageType, OutputImageType >
407 
409 
411 
412 private:
414 };
415 } // end namespace itk
416 
417 #ifndef ITK_MANUAL_INSTANTIATION
418 #include "itkNarrowBandLevelSetImageFilter.hxx"
419 #endif
420 
421 #endif
virtual void SetMaximumRMSError(const double) override
virtual const SegmentationFunctionType::VectorImageType * GetAdvectionImage() const
virtual void PrintSelf(std::ostream &os, Indent indent) const override
virtual void ReverseExpansionDirectionOn()
virtual void SetSegmentationFunction(SegmentationFunctionType *s)
Compute an approximate distance from an interpolated isocontour to the close grid points...
Superclass::InputImageType InputImageType
SegmentationFunctionType::VectorImageType VectorImageType
SegmentationLevelSetFunction< OutputImageType, FeatureImageType > SegmentationFunctionType
virtual const SegmentationFunctionType::ImageType * GetSpeedImage() const
This class compute the signed (positive and negative) chamfer distance in a narrow band...
virtual void SetInput(const InputImageType *image)
virtual void SetPropagationWeight(const ScalarValueType p)
virtual bool GetReverseExpansionDirection() const
NarrowBandImageFilterBase< TInputImage, TOutputImage > Superclass
virtual const IdentifierType & GetNumberOfIterations() const
void UpdateProgress(float progress)
Update the progress of the process object.
virtual void SetNumberOfIterations(IdentifierType _arg)
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Definition: itkMath.h:676
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
virtual void ReverseExpansionDirectionOff()
virtual void SetFeatureImage(const FeatureImageType *f)
virtual void SetFeatureImage(const FeatureImageType *f)
This class implements a multi-threaded finite difference image to image solver that can be applied to...
virtual void CreateNarrowBand() override
virtual void SetReverseExpansionDirection(bool _arg)
virtual void InitializeIteration() override
A base class which defines the API for implementing a special class of image segmentation filters usi...
Control indentation during Print() invocation.
Definition: itkIndent.h:49
ScalarValueType GetAdvectionWeight() const
typedef(Concept::HasNumericTraits< typename TOutputImage::PixelType >) OutputHasNumericTraitsCheck
virtual void SetNthInput(DataObjectPointerArraySizeType num, DataObject *input)
virtual void SetCurvatureWeight(const ScalarValueType c)
virtual void SetAdvectionWeight(const ScalarValueType a)
virtual VectorImageType * GetAdvectionImage() const
virtual const IdentifierType & GetElapsedIterations() const
ScalarValueType GetCurvatureWeight() const
#define itkConceptMacro(name, concept)
Templated n-dimensional image class.
Definition: itkImage.h:75
ScalarValueType GetPropagationWeight() const
virtual SegmentationFunctionType * GetSegmentationFunction()