Orfeo Toolbox  3.16
itkSparseFieldLevelSetImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkSparseFieldLevelSetImageFilter.h,v $
5  Language: C++
6  Date: $Date: 2009-04-25 12:28:10 $
7  Version: $Revision: 1.27 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkSparseFieldLevelSetImageFilter_h
18 #define __itkSparseFieldLevelSetImageFilter_h
19 
21 #include "itkMultiThreader.h"
22 #include "itkSparseFieldLayer.h"
23 #include "itkObjectStore.h"
24 #include <vector>
26 
27 namespace itk {
28 
33 template <class TValueType>
35 {
36 public:
37  TValueType m_Value;
40 };
41 
68 template <class TNeighborhoodType>
70 {
71 public:
72  typedef TNeighborhoodType NeighborhoodType;
74  typedef typename NeighborhoodType::RadiusType RadiusType;
75  itkStaticConstMacro(Dimension, unsigned int,
76  NeighborhoodType::Dimension );
77 
78  const RadiusType &GetRadius() const
79  { return m_Radius; }
80 
81  const unsigned int &GetArrayIndex(unsigned int i) const
82  { return m_ArrayIndex[i]; }
83 
84  const OffsetType &GetNeighborhoodOffset(unsigned int i) const
85  { return m_NeighborhoodOffset[i]; }
86 
87  const unsigned int &GetSize() const
88  { return m_Size; }
89 
90  int GetStride(unsigned int i)
91  { return m_StrideTable[i]; }
92 
95 
96  void Print(std::ostream &os) const;
97 
98 private:
99  unsigned int m_Size;
101  std::vector<unsigned int> m_ArrayIndex;
102  std::vector<OffsetType> m_NeighborhoodOffset;
103 
107 };
108 
109 
225 template <class TInputImage, class TOutputImage>
227  public FiniteDifferenceImageFilter<TInputImage, TOutputImage>
228 {
229 public:
235 
237  typedef typename Superclass::TimeStepType TimeStepType;
238  typedef typename Superclass::RadiusType RadiusType;
239  typedef typename Superclass::NeighborhoodScalesType NeighborhoodScalesType;
240 
242  itkNewMacro(Self);
243 
246 
248  typedef TInputImage InputImageType;
249  typedef TOutputImage OutputImageType;
251  itkStaticConstMacro(ImageDimension, unsigned int,
252  TOutputImage::ImageDimension);
253 
257 
260 
264 
266  typedef std::vector<LayerPointerType> LayerListType;
267 
269  typedef signed char StatusType;
270 
275 
279 
281  typedef std::vector<ValueType> UpdateBufferType;
282 
286  itkSetMacro(NumberOfLayers, unsigned int);
287  itkGetConstMacro(NumberOfLayers, unsigned int);
288 
290  itkSetMacro(IsoSurfaceValue, ValueType);
291  itkGetConstMacro(IsoSurfaceValue, ValueType);
292 
296  // itkGetConstMacro(RMSChange, ValueType);
297 
303  itkSetMacro(InterpolateSurfaceLocation, bool);
304  itkGetConstMacro(InterpolateSurfaceLocation, bool);
305 
307  void InterpolateSurfaceLocationOn()
308  { this->SetInterpolateSurfaceLocation(true); }
309  void InterpolateSurfaceLocationOff()
310  { this->SetInterpolateSurfaceLocation(false); }
311 
312 #ifdef ITK_USE_CONCEPT_CHECKING
313 
314  itkConceptMacro(OutputEqualityComparableCheck,
316  itkConceptMacro(DoubleConvertibleToOutputCheck,
318  itkConceptMacro(OutputOStreamWritableCheck,
321 #endif
322 
323 protected:
326  virtual void PrintSelf(std::ostream& os, Indent indent) const;
327 
332  inline virtual ValueType CalculateUpdateValue(
333  const IndexType &itkNotUsed(idx),
334  const TimeStepType &dt,
335  const ValueType &value,
336  const ValueType &change)
337  { return (value + dt * change); }
338 
342  virtual void PostProcessOutput();
343 
348  virtual void InitializeBackgroundPixels();
349 
351  void Initialize();
352 
357  void CopyInputToOutput();
358 
360  void AllocateUpdateBuffer();
361 
364  void ApplyUpdate(TimeStepType dt);
365 
368  TimeStepType CalculateChange();
369 
373  void ConstructLayer(StatusType from, StatusType to);
374 
379  void ConstructActiveLayer();
380 
382  void InitializeActiveLayerValues();
383 
391  void PropagateLayerValues(StatusType from, StatusType to,
392  StatusType promote, int InOrOut);
393 
398  void PropagateAllLayerValues();
399 
403  void UpdateActiveLayerValues(TimeStepType dt, LayerType *StatusUpList,
404  LayerType *StatusDownList);
406  void ProcessStatusList(LayerType *InputList, LayerType *OutputList,
407  StatusType ChangeToStatus, StatusType SearchForStatus);
408 
410  void ProcessOutsideList(LayerType *OutsideList, StatusType ChangeToStatus);
411 
412  itkGetConstMacro(ValueZero, ValueType);
413  itkGetConstMacro(ValueOne, ValueType);
414 
418 
422 
424  static ValueType m_ValueOne;
425 
427  static ValueType m_ValueZero;
428 
432 
436 
440 
444 
448 
453 
459 
464  unsigned int m_NumberOfLayers;
465 
468 
471 
473  ValueType m_IsoSurfaceValue;
474 
478 
482  // ValueType m_RMSChange;
483 
489 
490 private:
491  SparseFieldLevelSetImageFilter(const Self&);//purposely not implemented
492  void operator=(const Self&); //purposely not implemented
493 
497 
498 };
499 
500 
501 } // end namespace itk
502 
503 #ifndef ITK_MANUAL_INSTANTIATION
505 #endif
506 
507 #endif

Generated at Sun Feb 3 2013 00:07:57 for Orfeo Toolbox with doxygen 1.8.1.1