ITK  4.2.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 
26 namespace itk
27 {
142 template< class TInputImage,
143  class TFeatureImage,
144  class TOutputPixelType = float,
145  class TOutputImage = Image< TOutputPixelType,
148  public NarrowBandImageFilterBase< TInputImage, TOutputImage >
149 {
150 public:
151 
157 
159  typedef typename Superclass::ValueType ValueType;
160  typedef typename Superclass::IndexType IndexType;
161  typedef typename Superclass::TimeStepType TimeStepType;
162  typedef typename Superclass::InputImageType InputImageType;
163 
165  typedef TOutputImage OutputImageType;
166  typedef TFeatureImage FeatureImageType;
167 
171 
174 
177 
180  virtual void SetFeatureImage(const FeatureImageType *f)
181  {
182  this->ProcessObject::SetNthInput( 1, const_cast< FeatureImageType * >( f ) );
183  m_SegmentationFunction->SetFeatureImage(f);
184  }
186 
187  virtual FeatureImageType * GetFeatureImage()
188  {
189  return ( static_cast< FeatureImageType * >( this->ProcessObject::GetInput(1) ) );
190  }
191 
194  virtual void SetInitialImage(InputImageType *f)
195  {
196  this->SetInput(f);
197  }
198 
199  virtual const typename SegmentationFunctionType::ImageType * GetSpeedImage() const
200  { return m_SegmentationFunction->GetSpeedImage(); }
201 
202  virtual const typename SegmentationFunctionType::VectorImageType * GetAdvectionImage() const
203  { return m_SegmentationFunction->GetAdvectionImage(); }
204 
208  void SetUseNegativeFeaturesOn()
209  {
210  itkWarningMacro(
211  << "SetUseNegativeFeaturesOn has been deprecated. Please use ReverseExpansionDirectionOn() instead");
212  this->ReverseExpansionDirectionOn();
213  }
215 
216  void SetUseNegativeFeaturesOff()
217  {
218  itkWarningMacro(
219  << "SetUseNegativeFeaturesOff has been deprecated. Please use ReverseExpansionDirectionOff() instead");
220  this->ReverseExpansionDirectionOff();
221  }
222 
225  void SetUseNegativeFeatures(bool u)
226  {
227  itkWarningMacro(<< "SetUseNegativeFeatures has been deprecated. Please use SetReverseExpansionDirection instead");
228  if ( u == true )
229  {
230  this->SetReverseExpansionDirection(false);
231  }
232  else
233  {
234  this->SetReverseExpansionDirection(true);
235  }
236  }
238 
239  bool GetUseNegativeFeatures() const
240  {
241  itkWarningMacro(<< "GetUseNegativeFeatures has been deprecated. Please use GetReverseExpansionDirection() instead");
242  if ( this->GetReverseExpansionDirection() == false )
243  {
244  return true;
245  }
246  else
247  {
248  return false;
249  }
250  }
251 
260  itkSetMacro(ReverseExpansionDirection, bool);
261  itkGetConstMacro(ReverseExpansionDirection, bool);
262  itkBooleanMacro(ReverseExpansionDirection);
264 
269  void SetFeatureScaling(ValueType v)
270  {
271  if ( v != m_SegmentationFunction->GetPropagationWeight() )
272  {
273  this->SetPropagationScaling(v);
274  }
275  if ( v != m_SegmentationFunction->GetAdvectionWeight() )
276  {
277  this->SetAdvectionScaling(v);
278  }
279  }
281 
284  void SetPropagationScaling(ValueType v)
285  {
286  if ( v != m_SegmentationFunction->GetPropagationWeight() )
287  {
288  m_SegmentationFunction->SetPropagationWeight(v);
289  }
290  }
292 
293  ValueType GetPropagationScaling() const
294  {
295  return m_SegmentationFunction->GetPropagationWeight();
296  }
297 
300  void SetAdvectionScaling(ValueType v)
301  {
302  if ( v != m_SegmentationFunction->GetAdvectionWeight() )
303  {
304  m_SegmentationFunction->SetAdvectionWeight(v);
305  }
306  }
308 
309  ValueType GetAdvectionScaling() const
310  {
311  return m_SegmentationFunction->GetAdvectionWeight();
312  }
313 
318  void SetCurvatureScaling(ValueType v)
319  {
320  if ( v != m_SegmentationFunction->GetCurvatureWeight() )
321  {
322  m_SegmentationFunction->SetCurvatureWeight(v);
323  }
324  }
326 
327  ValueType GetCurvatureScaling() const
328  {
329  return m_SegmentationFunction->GetCurvatureWeight();
330  }
331 
334  virtual void SetSegmentationFunction(SegmentationFunctionType *s);
335 
336  virtual SegmentationFunctionType * GetSegmentationFunction()
337  { return m_SegmentationFunction; }
338 
341  void SetMaximumIterations(unsigned int i)
342  {
343  itkWarningMacro("SetMaximumIterations is deprecated. Please use SetNumberOfIterations instead.");
344  this->SetNumberOfIterations(i);
345  }
347 
348  unsigned int GetMaximumIterations()
349  {
350  itkWarningMacro("GetMaximumIterations is deprecated. Please use GetNumberOfIterations instead.");
351  return this->GetNumberOfIterations();
352  }
353 
354  virtual void SetMaximumRMSError(const double)
355  {
356  itkWarningMacro(
357  "The current implmentation of this solver does not compute maximum RMS change. The maximum RMS error value will not be set or used.");
358  }
359 
360 #ifdef ITK_USE_CONCEPT_CHECKING
361 
362  itkConceptMacro( OutputHasNumericTraitsCheck,
364 
366 #endif
367 protected:
370  NarrowBandLevelSetImageFilter(const Self &); //purposely not implemented
372 
373  virtual void PrintSelf(std::ostream & os, Indent indent) const;
374 
375  void operator=(const Self &); //purposely not implemented
376 
378  virtual void InitializeIteration()
379  {
380  Superclass::InitializeIteration();
381  // Estimate the progress of the filter
382  this->SetProgress( (float)( (float)this->GetElapsedIterations()
383  / (float)this->GetNumberOfIterations() ) );
384  }
386 
390  virtual void CreateNarrowBand();
391 
394  void GenerateData();
395 
399 
407 
409 
411 private:
413 };
414 } // end namespace itk
415 
416 #ifndef ITK_MANUAL_INSTANTIATION
417 #include "itkNarrowBandLevelSetImageFilter.hxx"
418 #endif
419 
420 #endif
421