ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkVotingBinaryHoleFillFloodingImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: itkVotingBinaryHoleFillFloodingImageFilter.h
5  Language: C++
6  Date: $Date$
7  Version: $Revision$
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 __itkVotingBinaryHoleFillFloodingImageFilter_h
18 #define __itkVotingBinaryHoleFillFloodingImageFilter_h
19 
20 #include "itkImage.h"
22 
23 #include <vector>
24 
25 namespace itk
26 {
27 
39 template <class TInputImage, class TOutputImage>
41  public VotingBinaryImageFilter<TInputImage,TOutputImage>
42 {
43 public:
49 
51  itkNewMacro(Self);
52 
55 
56  typedef typename Superclass::InputImageType InputImageType;
57  typedef typename InputImageType::Pointer InputImagePointer;
58  typedef typename InputImageType::ConstPointer InputImageConstPointer;
59  typedef typename InputImageType::RegionType InputImageRegionType;
60  typedef typename InputImageType::PixelType InputImagePixelType;
61  typedef typename InputImageType::IndexType IndexType;
63 
64  typedef typename Superclass::OutputImageType OutputImageType;
65  typedef typename OutputImageType::Pointer OutputImagePointer;
66  typedef typename OutputImageType::RegionType OutputImageRegionType;
67  typedef typename OutputImageType::PixelType OutputImagePixelType;
68 
69  typedef typename Superclass::InputSizeType InputSizeType;
70 
72  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
73  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
75 
82  itkGetConstReferenceMacro( MajorityThreshold, unsigned int );
83  itkSetMacro( MajorityThreshold, unsigned int );
85 
88  itkSetMacro( MaximumNumberOfIterations, unsigned int );
89  itkGetMacro( MaximumNumberOfIterations, unsigned int );
91 
93  itkGetMacro( CurrentIterationNumber, unsigned int );
94 
96  itkGetMacro( TotalNumberOfPixelsChanged, unsigned int );
97 
98 
99 #ifdef ITK_USE_CONCEPT_CHECKING
100 
101  itkConceptMacro(OutputEqualityComparableCheck, (Concept::EqualityComparable<OutputImagePixelType>));
102  itkConceptMacro(InputEqualityComparableCheck, (Concept::EqualityComparable<InputImagePixelType>));
107 
109 #endif
110 
111 protected:
114 
115  void GenerateData();
116 
117  void PrintSelf ( std::ostream& os, Indent indent ) const;
118 
119 private:
120  VotingBinaryHoleFillFloodingImageFilter(const Self&); //purposely not implemented
121  void operator=(const Self&); //purposely not implemented
122 
123 
124  void AllocateOutputImageWorkingMemory();
125 
126  void InitializeNeighborhood();
127 
128  void FindAllPixelsInTheBoundaryAndAddThemAsSeeds();
129 
130  void IterateFrontPropagations();
131 
132  void VisitAllSeedsAndTransitionTheirState();
133 
134  void PasteNewSeedValuesToOutputImage();
135 
136  void SwapSeedArrays();
137 
138  void ClearSecondSeedArray();
139 
140  bool TestForQuorumAtCurrentPixel() const;
141 
142  void PutCurrentPixelNeighborsIntoSeedArray();
143 
144  void ComputeArrayOfNeighborhoodBufferOffsets();
145 
146  void ComputeBirthThreshold();
147 
148  unsigned int GetNeighborhoodSize() const;
149 
150  itkSetMacro( CurrentPixelIndex, IndexType );
151  itkGetConstReferenceMacro( CurrentPixelIndex, IndexType );
152 
153  unsigned int m_MajorityThreshold;
154 
155  typedef std::vector<IndexType> SeedArrayType;
156 
159 
161 
162  typedef std::vector<OutputImagePixelType> SeedNewValuesArrayType;
163 
165 
170 
172 
173  //
174  // Variables used for addressing the Neighbors.
175  // This could be factorized into a helper class.
176  //
177  OffsetValueType m_OffsetTable[ InputImageDimension + 1 ];
178 
179  typedef std::vector< OffsetValueType > NeighborOffsetArrayType;
180 
182 
183 
184  //
185  // Helper cache variables
186  //
189 
192 
194 
196 
198 };
199 
200 } // end namespace itk
201 
202 #ifndef ITK_MANUAL_INSTANTIATION
203 #include "itkVotingBinaryHoleFillFloodingImageFilter.hxx"
204 #endif
205 
206 #endif
signed long OffsetValueType
Definition: itkIntTypes.h:154
VotingBinaryImageFilter< TInputImage, TOutputImage > Superclass
Perform front-propagation under a quorum sensing (voting) algorithm for filling holes in a binary mas...
Base class for all process objects that output image data.
InputImageType::RegionType InputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::Image< unsigned char, InputImageDimension > SeedMaskImageType
TOutputImage OutputImageType
Applies a voting operation in a neighborhood of each pixel.
#define itkConceptMacro(name, concept)
itk::Neighborhood< InputImagePixelType, InputImageDimension > NeighborhoodType
Templated n-dimensional image class.
Definition: itkImage.h:75