Orfeo Toolbox  3.16
itkNarrowBandImageFilterBase.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkNarrowBandImageFilterBase.h,v $
5  Language: C++
6  Date: $Date: 2009-04-25 12:27:38 $
7  Version: $Revision: 1.11 $
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 __itkNarrowBandImageFilterBase_h
18 #define __itkNarrowBandImageFilterBase_h
19 
21 #include "itkMultiThreader.h"
22 #include "itkNarrowBand.h"
23 #include "itkBarrier.h"
24 #include "itkObjectStore.h"
25 
26 namespace itk {
27 
65 template <class TInputImage, class TOutputImage>
67  : public FiniteDifferenceImageFilter<TInputImage, TOutputImage>
68 {
69 public:
75 
78 
83 
86  itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
87 
90  typedef typename Superclass::PixelType PixelType;
91 
94 
96  typedef typename OutputImageType::IndexType IndexType;
97 
100  typedef typename OutputImageType::ValueType ValueType;
101 
104 
109 
111  itkSetMacro( IsoSurfaceValue, ValueType);
112  itkGetConstMacro( IsoSurfaceValue, ValueType);
113 
115  // itkGetConstMacro( RMSChange, ValueType);
116 
122  {
123  m_NarrowBand->PushBack(node); // add new node
124  this->Modified();
125  }
127  {
128  BandNodeType tmpnode;
129  tmpnode.m_Index = index;
130  m_NarrowBand->PushBack(tmpnode);
131  this->Modified();
132  }
133  void InsertNarrowBandNode (IndexType &index, PixelType &value, signed char &nodestate)
134  {
135  BandNodeType tmpnode;
136  tmpnode.m_Data = value;
137  tmpnode.m_Index = index;
138  tmpnode.m_NodeState = nodestate;
139 
140  m_NarrowBand->PushBack(tmpnode);
141  this->Modified();
142  }
143 
147  void SetNarrowBandTotalRadius (float val)
148  {
149  if (m_NarrowBand->GetTotalRadius() != val)
150  {
151  m_NarrowBand->SetTotalRadius(val);
152  this->Modified();
153  }
154  }
155 
158  {
159  return m_NarrowBand->GetTotalRadius();
160  }
161 
164  void SetNarrowBandInnerRadius (float val)
165  {
166  if (m_NarrowBand->GetInnerRadius() != val)
167  {
168  m_NarrowBand->SetInnerRadius(val);
169  this->Modified();
170  }
171  }
172 
175  {
176  return m_NarrowBand->GetInnerRadius();
177  }
178 
184  virtual void CreateNarrowBand (){};
185 
186  virtual void SetNarrowBand(NarrowBandType * ptr)
187  {
188  if ( m_NarrowBand != ptr )
189  {
190  m_NarrowBand = ptr;
191  this->Modified();
192  }
193  }
194 
195  virtual void CopyInputToOutput ();
196 
197 protected:
200  {
202  m_NarrowBand->SetTotalRadius(4);
203  m_NarrowBand->SetInnerRadius(2);
205  m_IsoSurfaceValue = 0.0;
206  m_Step = 0;
207  m_Touched = false;
209  }
210 
212  void PrintSelf(std::ostream& os, Indent indent) const;
213 
217  {
218  typename NarrowBandType::Iterator first; // this is the actual first element
219  typename NarrowBandType::Iterator last; // this is one past the actual last //element
220  };
221 
224  std::vector<RegionType> m_RegionList;
225 
228  void GetSplitRegion (int i, ThreadRegionType &splitRegion);
229 
234  virtual void Initialize();
235 
240  virtual void InitializeIteration();
241 
244  virtual void PostProcessOutput();
245 
246  /* This function clears all pixels from the narrow band */
247  void ClearNarrowBand ();
248 
250  void WaitForAll();
251 
255  virtual void GenerateData();
256 
257  /* Variables to control reinitialization */
259  unsigned int m_Step;
260  bool m_Touched;
263 
265 
266 private:
267  NarrowBandImageFilterBase(const Self&); //purposely not implemented
268  void operator=(const Self&); //purposely not implemented
269 
273  {
278  };
279 
280  /* This class does not use AllocateUpdateBuffer to allocate memory for its
281  * narrow band. This is taken care of in SetNarrowBand, and InsertNarrowBandNode
282  * functions. This function is here for compatability with the
283  * FiniteDifferenceSolver framework.
284  */
285  virtual void AllocateUpdateBuffer() {};
286 
287 
290 
294  virtual void ThreadedIterate(void *arg, int threadId);
295 
299  virtual void ThreadedApplyUpdate(TimeStepType dt,
300  const ThreadRegionType &regionToProcess,
301  int threadId);
302  virtual void ApplyUpdate(TimeStepType){}
303 
307  virtual TimeStepType ThreadedCalculateChange(const ThreadRegionType &regionToProcess,
308  int threadId);
309  virtual TimeStepType CalculateChange() {return 0;}
310 
311 };
312 
313 }// end namespace itk
314 
315 #ifndef ITK_MANUAL_INSTANTIATION
317 #endif
318 
319 #endif

Generated at Sat Feb 2 2013 23:55:18 for Orfeo Toolbox with doxygen 1.8.1.1