ITK  5.2.0
Insight Toolkit
itkNarrowBandLevelSetImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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, TInputImage::ImageDimension>>
147 class ITK_TEMPLATE_EXPORT NarrowBandLevelSetImageFilter : public NarrowBandImageFilterBase<TInputImage, TOutputImage>
148 {
149 public:
150  ITK_DISALLOW_COPY_AND_MOVE(NarrowBandLevelSetImageFilter);
151 
157 
159  using ValueType = typename Superclass::ValueType;
161  using TimeStepType = typename Superclass::TimeStepType;
162  using InputImageType = typename Superclass::InputImageType;
163 
165  using OutputImageType = TOutputImage;
166  using FeatureImageType = TFeatureImage;
167 
170 
173 
176 
179  virtual void
181  {
182  this->ProcessObject::SetNthInput(1, const_cast<FeatureImageType *>(f));
183  m_SegmentationFunction->SetFeatureImage(f);
184  }
186 
187  virtual FeatureImageType *
189  {
190  return (static_cast<FeatureImageType *>(this->ProcessObject::GetInput(1)));
191  }
192 
195  virtual void
197  {
198  this->SetInput(f);
199  }
200 
201  virtual const typename SegmentationFunctionType::ImageType *
203  {
204  return m_SegmentationFunction->GetSpeedImage();
205  }
206 
207  virtual const typename SegmentationFunctionType::VectorImageType *
209  {
210  return m_SegmentationFunction->GetAdvectionImage();
211  }
212 
216  void
218  {
219  itkWarningMacro(
220  << "SetUseNegativeFeaturesOn has been deprecated. Please use ReverseExpansionDirectionOn() instead");
221  this->ReverseExpansionDirectionOn();
222  }
224 
225  void
227  {
228  itkWarningMacro(
229  << "SetUseNegativeFeaturesOff has been deprecated. Please use ReverseExpansionDirectionOff() instead");
230  this->ReverseExpansionDirectionOff();
231  }
232 
235  void
237  {
238  itkWarningMacro(<< "SetUseNegativeFeatures has been deprecated. Please use SetReverseExpansionDirection instead");
239  if (u == true)
240  {
241  this->SetReverseExpansionDirection(false);
242  }
243  else
244  {
245  this->SetReverseExpansionDirection(true);
246  }
247  }
249 
250  bool
252  {
253  itkWarningMacro(
254  << "GetUseNegativeFeatures has been deprecated. Please use GetReverseExpansionDirection() instead");
255  if (this->GetReverseExpansionDirection() == false)
256  {
257  return true;
258  }
259  else
260  {
261  return false;
262  }
263  }
264 
273  itkSetMacro(ReverseExpansionDirection, bool);
274  itkGetConstMacro(ReverseExpansionDirection, bool);
275  itkBooleanMacro(ReverseExpansionDirection);
277 
282  void
284  {
285  if (v != m_SegmentationFunction->GetPropagationWeight())
286  {
287  this->SetPropagationScaling(v);
288  }
289  if (v != m_SegmentationFunction->GetAdvectionWeight())
290  {
291  this->SetAdvectionScaling(v);
292  }
293  }
295 
298  void
300  {
301  if (Math::NotExactlyEquals(v, m_SegmentationFunction->GetPropagationWeight()))
302  {
303  m_SegmentationFunction->SetPropagationWeight(v);
304  }
305  }
307 
308  ValueType
310  {
311  return m_SegmentationFunction->GetPropagationWeight();
312  }
313 
316  void
318  {
319  if (Math::NotExactlyEquals(v, m_SegmentationFunction->GetAdvectionWeight()))
320  {
321  m_SegmentationFunction->SetAdvectionWeight(v);
322  }
323  }
325 
326  ValueType
328  {
329  return m_SegmentationFunction->GetAdvectionWeight();
330  }
331 
336  void
338  {
339  if (Math::NotExactlyEquals(v, m_SegmentationFunction->GetCurvatureWeight()))
340  {
341  m_SegmentationFunction->SetCurvatureWeight(v);
342  }
343  }
345 
346  ValueType
348  {
349  return m_SegmentationFunction->GetCurvatureWeight();
350  }
351 
354  virtual void
355  SetSegmentationFunction(SegmentationFunctionType * s);
356 
357  virtual SegmentationFunctionType *
359  {
360  return m_SegmentationFunction;
361  }
362 
365  void
366  SetMaximumIterations(unsigned int i)
367  {
368  itkWarningMacro("SetMaximumIterations is deprecated. Please use SetNumberOfIterations instead.");
369  this->SetNumberOfIterations(i);
370  }
372 
373  unsigned int
375  {
376  itkWarningMacro("GetMaximumIterations is deprecated. Please use GetNumberOfIterations instead.");
377  return this->GetNumberOfIterations();
378  }
379 
380  void
381  SetMaximumRMSError(const double) override
382  {
383  itkWarningMacro("The current implementation of this solver does not compute maximum RMS change. The maximum RMS "
384  "error value will not be set or used.");
385  }
386 
387 #ifdef ITK_USE_CONCEPT_CHECKING
388  // Begin concept checking
390  // End concept checking
391 #endif
392 
393 protected:
394  ~NarrowBandLevelSetImageFilter() override = default;
396 
397  void
398  PrintSelf(std::ostream & os, Indent indent) const override;
399 
400 
402  void
404  {
405  Superclass::InitializeIteration();
406  // Estimate the progress of the filter
407  this->UpdateProgress((float)((float)this->GetElapsedIterations() / (float)this->GetNumberOfIterations()));
408  }
410 
414  void
415  CreateNarrowBand() override;
416 
419  void
420  GenerateData() override;
421 
425 
431 
433 
435 
436 private:
438 };
439 } // end namespace itk
440 
441 #ifndef ITK_MANUAL_INSTANTIATION
442 # include "itkNarrowBandLevelSetImageFilter.hxx"
443 #endif
444 
445 #endif
itk::NarrowBandLevelSetImageFilter< TInputImage, TFeatureImage, TOutputPixelType, Image< TOutputPixelType, TInputImage::ImageDimension > >::VectorImageType
typename SegmentationFunctionType::VectorImageType VectorImageType
Definition: itkNarrowBandLevelSetImageFilter.h:172
itk::NarrowBandImageFilterBase
This class implements a multi-threaded finite difference image to image solver that can be applied to...
Definition: itkNarrowBandImageFilterBase.h:69
itk::NarrowBandLevelSetImageFilter::SetMaximumIterations
void SetMaximumIterations(unsigned int i)
Definition: itkNarrowBandLevelSetImageFilter.h:366
itk::NarrowBandLevelSetImageFilter::GetCurvatureScaling
ValueType GetCurvatureScaling() const
Definition: itkNarrowBandLevelSetImageFilter.h:347
itk::Concept::HasNumericTraits
Definition: itkConceptChecking.h:714
itk::NarrowBandLevelSetImageFilter
A base class which defines the API for implementing a special class of image segmentation filters usi...
Definition: itkNarrowBandLevelSetImageFilter.h:147
itk::NarrowBandLevelSetImageFilter::SetCurvatureScaling
void SetCurvatureScaling(ValueType v)
Definition: itkNarrowBandLevelSetImageFilter.h:337
itk::NarrowBandLevelSetImageFilter::GetFeatureImage
virtual FeatureImageType * GetFeatureImage()
Definition: itkNarrowBandLevelSetImageFilter.h:188
itk::FiniteDifferenceImageFilter< TInputImage, Image< TOutputPixelType, TInputImage::ImageDimension > >::TimeStepType
typename FiniteDifferenceFunctionType::TimeStepType TimeStepType
Definition: itkFiniteDifferenceImageFilter.h:166
itk::NarrowBandImageFilterBase< TInputImage, Image< TOutputPixelType, TInputImage::ImageDimension > >::IndexType
typename OutputImageType::IndexType IndexType
Definition: itkNarrowBandImageFilterBase.h:100
itk::NarrowBandLevelSetImageFilter::SetUseNegativeFeaturesOff
void SetUseNegativeFeaturesOff()
Definition: itkNarrowBandLevelSetImageFilter.h:226
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::Math::NotExactlyEquals
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Definition: itkMath.h:733
itk::IsoContourDistanceImageFilter
Compute an approximate distance from an interpolated isocontour to the close grid points.
Definition: itkIsoContourDistanceImageFilter.h:59
itk::NarrowBandLevelSetImageFilter::GetMaximumIterations
unsigned int GetMaximumIterations()
Definition: itkNarrowBandLevelSetImageFilter.h:374
itk::NarrowBandLevelSetImageFilter::GetPropagationScaling
ValueType GetPropagationScaling() const
Definition: itkNarrowBandLevelSetImageFilter.h:309
itk::NarrowBandLevelSetImageFilter::SetFeatureImage
virtual void SetFeatureImage(const FeatureImageType *f)
Definition: itkNarrowBandLevelSetImageFilter.h:180
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itkSegmentationLevelSetFunction.h
itk::NarrowBandLevelSetImageFilter::GetSegmentationFunction
virtual SegmentationFunctionType * GetSegmentationFunction()
Definition: itkNarrowBandLevelSetImageFilter.h:358
itk::NarrowBandLevelSetImageFilter::m_ReverseExpansionDirection
bool m_ReverseExpansionDirection
Definition: itkNarrowBandLevelSetImageFilter.h:424
itk::NarrowBandLevelSetImageFilter::SetInitialImage
virtual void SetInitialImage(InputImageType *f)
Definition: itkNarrowBandLevelSetImageFilter.h:196
itk::NarrowBandLevelSetImageFilter::SetPropagationScaling
void SetPropagationScaling(ValueType v)
Definition: itkNarrowBandLevelSetImageFilter.h:299
itk::NarrowBandLevelSetImageFilter::SetFeatureScaling
void SetFeatureScaling(ValueType v)
Definition: itkNarrowBandLevelSetImageFilter.h:283
itk::NarrowBandLevelSetImageFilter::m_ChamferFilter
ChamferFilterType::Pointer m_ChamferFilter
Definition: itkNarrowBandLevelSetImageFilter.h:434
itk::NarrowBandLevelSetImageFilter::SetUseNegativeFeaturesOn
void SetUseNegativeFeaturesOn()
Definition: itkNarrowBandLevelSetImageFilter.h:217
itk::NarrowBandLevelSetImageFilter::m_SegmentationFunction
SegmentationFunctionType * m_SegmentationFunction
Definition: itkNarrowBandLevelSetImageFilter.h:437
itkIsoContourDistanceImageFilter.h
itk::NarrowBandLevelSetImageFilter::GetUseNegativeFeatures
bool GetUseNegativeFeatures() const
Definition: itkNarrowBandLevelSetImageFilter.h:251
itk::NarrowBandLevelSetImageFilter::InitializeIteration
void InitializeIteration() override
Definition: itkNarrowBandLevelSetImageFilter.h:403
itk::ImageToImageFilter< TInputImage, Image< TOutputPixelType, TInputImage::ImageDimension > >::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkFastChamferDistanceImageFilter.h
itk::NarrowBandLevelSetImageFilter::GetSpeedImage
virtual const SegmentationFunctionType::ImageType * GetSpeedImage() const
Definition: itkNarrowBandLevelSetImageFilter.h:202
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkNarrowBandImageFilterBase.h
itk::ProcessObject::SetNthInput
virtual void SetNthInput(DataObjectPointerArraySizeType idx, DataObject *input)
itk::NarrowBandLevelSetImageFilter::GetAdvectionImage
virtual const SegmentationFunctionType::VectorImageType * GetAdvectionImage() const
Definition: itkNarrowBandLevelSetImageFilter.h:208
itk::SegmentationLevelSetFunction
Definition: itkSegmentationLevelSetFunction.h:47
itk::NarrowBandLevelSetImageFilter::GetAdvectionScaling
ValueType GetAdvectionScaling() const
Definition: itkNarrowBandLevelSetImageFilter.h:327
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:86
itk::FastChamferDistanceImageFilter
This class compute the signed (positive and negative) chamfer distance in a narrow band.
Definition: itkFastChamferDistanceImageFilter.h:56
itk::NarrowBandLevelSetImageFilter::SetMaximumRMSError
void SetMaximumRMSError(const double) override
Definition: itkNarrowBandLevelSetImageFilter.h:381
itk::NarrowBandImageFilterBase< TInputImage, Image< TOutputPixelType, TInputImage::ImageDimension > >::ValueType
typename OutputImageType::ValueType ValueType
Definition: itkNarrowBandImageFilterBase.h:104
itk::NarrowBandLevelSetImageFilter< TInputImage, TFeatureImage, TOutputPixelType, Image< TOutputPixelType, TInputImage::ImageDimension > >::FeatureImageType
TFeatureImage FeatureImageType
Definition: itkNarrowBandLevelSetImageFilter.h:166
itkMath.h
itk::ProcessObject::GetInput
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
itk::NarrowBandLevelSetImageFilter::m_IsoFilter
IsoFilterType::Pointer m_IsoFilter
Definition: itkNarrowBandLevelSetImageFilter.h:432
itk::NarrowBandLevelSetImageFilter::SetUseNegativeFeatures
void SetUseNegativeFeatures(bool u)
Definition: itkNarrowBandLevelSetImageFilter.h:236
itk::NarrowBandLevelSetImageFilter::SetAdvectionScaling
void SetAdvectionScaling(ValueType v)
Definition: itkNarrowBandLevelSetImageFilter.h:317