Orfeo Toolbox  4.2
itkSparseFieldFourthOrderLevelSetImageFilter.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 __itkSparseFieldFourthOrderLevelSetImageFilter_h
19 #define __itkSparseFieldFourthOrderLevelSetImageFilter_h
20 
25 #include <cmath>
26 
27 namespace itk
28 {
37 template< typename TImageType >
39 {
40 public:
42  typedef TImageType LevelSetImageType;
43 
45  typedef typename LevelSetImageType::PixelType NodeValueType;
46 
48  typedef typename LevelSetImageType::IndexType IndexType;
49 
51  typedef Vector< NodeValueType,
52  TImageType ::ImageDimension >
54 
57 
60 
63 
67  m_ManifoldNormal[TImageType::ImageDimension];
68 
70  NodeDataType m_Flux[TImageType::ImageDimension];
71 
75 
79 
82 
86 };
87 
155 template< typename TInputImage, typename TOutputImage >
157  public SparseFieldLevelSetImageFilter< TInputImage, TOutputImage >
158 {
159 public:
165 
169 
171  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
172 
180 
184 
186  typedef SparseImage< NodeType,
187  itkGetStaticConstMacro(ImageDimension) > SparseImageType;
188 
191 
194 
198 
202 
204  //typedef typename NormalVectorFunctionType::RadiusType RadiusType;
205 
209 
210  itkGetConstReferenceMacro(MaxRefitIteration, unsigned int);
211  itkSetMacro(MaxRefitIteration, unsigned int);
212  itkGetConstReferenceMacro(MaxNormalIteration, unsigned int);
213  itkSetMacro(MaxNormalIteration, unsigned int);
214  itkGetConstReferenceMacro(CurvatureBandWidth, ValueType);
215  itkSetMacro(CurvatureBandWidth, ValueType);
216  itkGetConstReferenceMacro(RMSChangeNormalProcessTrigger, ValueType);
217  itkSetMacro(RMSChangeNormalProcessTrigger, ValueType);
218  itkGetConstReferenceMacro(NormalProcessType, int);
219  itkSetMacro(NormalProcessType, int);
220  itkGetConstReferenceMacro(NormalProcessConductance, ValueType);
221  itkSetMacro(NormalProcessConductance, ValueType);
222  itkSetMacro(NormalProcessUnsharpFlag, bool);
223  itkGetConstReferenceMacro(NormalProcessUnsharpFlag, bool);
224  itkSetMacro(NormalProcessUnsharpWeight, ValueType);
225  itkGetConstReferenceMacro(NormalProcessUnsharpWeight, ValueType);
226 
230 
234  unsigned int GetMinimumNumberOfLayers() const
235  {
236  return (int)std::ceil( m_CurvatureBandWidth
237  + itkGetStaticConstMacro(ImageDimension) );
238  }
239 
242  virtual void SetNumberOfLayers(const unsigned int n)
243  {
244  unsigned int nm = vnl_math_max (this->GetMinimumNumberOfLayers (), n);
245 
246  if ( nm != this->GetNumberOfLayers() )
247  {
249  this->Modified();
250  }
251  }
252 
255  virtual void InitializeIteration()
256  {
258  ValueType rmschange = this->GetRMSChange();
259 
260  if ( ( this->GetElapsedIterations() == 0 )
262  || ( rmschange <= m_RMSChangeNormalProcessTrigger )
263  || ( this->ActiveLayerCheckBand() ) )
264  {
265  if ( ( this->GetElapsedIterations() != 0 )
266  && ( rmschange <= m_RMSChangeNormalProcessTrigger )
267  && ( m_RefitIteration <= 1 ) )
268  {
269  m_ConvergenceFlag = true;
270  }
271 
272  m_RefitIteration = 0;
273  ProcessNormals();
274  }
275 
277  }
278 
279 #ifdef ITK_USE_CONCEPT_CHECKING
280  // Begin concept checking
281  itkConceptMacro( OutputHasNumericTraitsCheck,
283  // End concept checking
284 #endif
285 
286 protected:
289  virtual void PrintSelf(std::ostream & os, Indent indent) const;
290 
294  (SparseImageIteratorType & neighborhood) const;
295 
299  void ComputeCurvatureTarget(const OutputImageType *distanceImage,
300  SparseImageType *sparseImage) const;
301 
303  void ProcessNormals();
304 
309  bool ActiveLayerCheckBand() const;
310 
311 private:
314  unsigned int m_RefitIteration;
315 
319  unsigned int m_MaxRefitIteration;
320 
323  unsigned int m_MaxNormalIteration;
324 
329 
333 
337 
343 
347 
351 
355 
359 
362  static const ValueType m_DimConst;
363 
365  //purposely not implemented
366  void operator=(const Self &); //purposely not implemented
367 };
368 } // end namespace itk
369 
370 #ifndef ITK_MANUAL_INSTANTIATION
372 #endif
373 
374 #endif

Generated at Sat Aug 30 2014 15:38:33 for Orfeo Toolbox with doxygen 1.8.3.1