ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkSparseFieldLevelSetImageFilter.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 __itkSparseFieldLevelSetImageFilter_h
19 #define __itkSparseFieldLevelSetImageFilter_h
20 
22 #include "itkMultiThreader.h"
23 #include "itkSparseFieldLayer.h"
24 #include "itkObjectStore.h"
25 #include <vector>
27 
28 namespace itk
29 {
35 template< typename TValue >
37 {
38 public:
39  TValue m_Value;
42 };
43 
72 template< typename TNeighborhoodType >
74 {
75 public:
76  typedef TNeighborhoodType NeighborhoodType;
79  itkStaticConstMacro(Dimension, unsigned int,
80  NeighborhoodType::Dimension);
82 
83  const RadiusType & GetRadius() const
84  { return m_Radius; }
85 
86  const unsigned int & GetArrayIndex(unsigned int i) const
87  { return m_ArrayIndex[i]; }
88 
89  const OffsetType & GetNeighborhoodOffset(unsigned int i) const
90  { return m_NeighborhoodOffset[i]; }
91 
92  const unsigned int & GetSize() const
93  { return m_Size; }
94 
95  int GetStride(unsigned int i)
96  { return m_StrideTable[i]; }
97 
100 
101  void Print(std::ostream & os) const;
102 
103 private:
104  unsigned int m_Size;
106  std::vector< unsigned int > m_ArrayIndex;
107  std::vector< OffsetType > m_NeighborhoodOffset;
108 
112 };
113 
229 template< typename TInputImage, typename TOutputImage >
231  public FiniteDifferenceImageFilter< TInputImage, TOutputImage >
232 {
233 public:
234 
240 
245 
247  itkNewMacro(Self);
248 
251 
253  typedef TInputImage InputImageType;
254  typedef TOutputImage OutputImageType;
256  itkStaticConstMacro(ImageDimension, unsigned int,
257  TOutputImage::ImageDimension);
258 
262 
265 
269 
271  typedef std::vector< LayerPointerType > LayerListType;
272 
274  typedef signed char StatusType;
275 
280 
284 
286  typedef std::vector< ValueType > UpdateBufferType;
287 
291  itkSetMacro(NumberOfLayers, unsigned int);
292  itkGetConstMacro(NumberOfLayers, unsigned int);
294 
296  itkSetMacro(IsoSurfaceValue, ValueType);
297  itkGetConstMacro(IsoSurfaceValue, ValueType);
299 
303  // itkGetConstMacro(RMSChange, ValueType);
304 
310  itkSetMacro(InterpolateSurfaceLocation, bool);
311  itkGetConstMacro(InterpolateSurfaceLocation, bool);
313 
316  { this->SetInterpolateSurfaceLocation(true); }
318  { this->SetInterpolateSurfaceLocation(false); }
320 
321 #ifdef ITK_USE_CONCEPT_CHECKING
322  // Begin concept checking
323  itkConceptMacro( OutputEqualityComparableCheck,
325  itkConceptMacro( DoubleConvertibleToOutputCheck,
327  itkConceptMacro( OutputOStreamWritableCheck,
329  // End concept checking
330 #endif
331 
332 protected:
335  virtual void PrintSelf(std::ostream & os, Indent indent) const;
336 
342  const IndexType & itkNotUsed(idx),
343  const TimeStepType & dt,
344  const ValueType & value,
345  const ValueType & change)
346  { return ( value + dt * change ); }
347 
351  virtual void PostProcessOutput();
352 
357  virtual void InitializeBackgroundPixels();
358 
360  void Initialize();
361 
366  void CopyInputToOutput();
367 
369  void AllocateUpdateBuffer();
370 
373  void ApplyUpdate(const TimeStepType& dt);
374 
378 
382  void ConstructLayer(StatusType from, StatusType to);
383 
388  void ConstructActiveLayer();
389 
392 
401  StatusType promote, int InOrOut);
402 
408 
412  void UpdateActiveLayerValues(TimeStepType dt, LayerType *StatusUpList,
413  LayerType *StatusDownList);
414 
416  void ProcessStatusList(LayerType *InputList, LayerType *OutputList,
417  StatusType ChangeToStatus, StatusType SearchForStatus);
418 
420  void ProcessOutsideList(LayerType *OutsideList, StatusType ChangeToStatus);
421 
422  itkGetConstMacro(ValueZero, ValueType);
423  itkGetConstMacro(ValueOne, ValueType);
424 
428 
432 
435 
438 
442 
446 
450 
454 
458 
463 
469 
474  unsigned int m_NumberOfLayers;
475 
478 
481 
484 
488 
492  // ValueType m_RMSChange;
493 
499 
502 
503 private:
504  SparseFieldLevelSetImageFilter(const Self &); //purposely not implemented
505  void operator=(const Self &); //purposely not implemented
506 
510 };
511 } // end namespace itk
512 
513 #ifndef ITK_MANUAL_INSTANTIATION
514 #include "itkSparseFieldLevelSetImageFilter.hxx"
515 #endif
516 
517 #endif
void ProcessOutsideList(LayerType *OutsideList, StatusType ChangeToStatus)
SparseFieldCityBlockNeighborList< NeighborhoodIterator< OutputImageType > > m_NeighborList
Light weight base class for most itk classes.
void ConstructLayer(StatusType from, StatusType to)
Image< StatusType, itkGetStaticConstMacro(ImageDimension) > StatusImageType
void ProcessStatusList(LayerType *InputList, LayerType *OutputList, StatusType ChangeToStatus, StatusType SearchForStatus)
virtual void PrintSelf(std::ostream &os, Indent indent) const
A convenience class for storing indices which reference neighbor pixels within a neighborhood.
virtual ValueType CalculateUpdateValue(const IndexType &, const TimeStepType &dt, const ValueType &value, const ValueType &change)
TPixel ValueType
Definition: itkImage.h:96
This class implements a finite difference partial differential equation solver for evolving surfaces ...
void ApplyUpdate(const TimeStepType &dt)
FiniteDifferenceFunctionType::NeighborhoodScalesType NeighborhoodScalesType
FiniteDifferenceFunctionType::RadiusType RadiusType
Superclass::IndexType IndexType
Definition: itkImage.h:122
virtual void SetInterpolateSurfaceLocation(bool _arg)
Superclass::RadiusType RadiusType
FiniteDifferenceImageFilter< TInputImage, TOutputImage > Superclass
Superclass::NeighborhoodScalesType NeighborhoodScalesType
SparseFieldLevelSetNode< IndexType > LayerNodeType
FiniteDifferenceFunctionType::TimeStepType TimeStepType
void PropagateLayerValues(StatusType from, StatusType to, StatusType promote, int InOrOut)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
const unsigned int & GetArrayIndex(unsigned int i) const
A very simple linked list that is used to manage nodes in a layer of a sparse field level-set solver...
#define itkConceptMacro(name, concept)
A specialized memory management object for allocating and destroying contiguous blocks of objects...
void Print(std::ostream &os) const
void UpdateActiveLayerValues(TimeStepType dt, LayerType *StatusUpList, LayerType *StatusDownList)
const OffsetType & GetNeighborhoodOffset(unsigned int i) const
Templated n-dimensional image class.
Definition: itkImage.h:75