ITK  5.0.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 <typename TInputImage, typename TOutputImage>
40 class ITK_TEMPLATE_EXPORT VotingBinaryHoleFillFloodingImageFilter:
41  public VotingBinaryImageFilter<TInputImage,TOutputImage>
42 {
43 public:
44  ITK_DISALLOW_COPY_AND_ASSIGN(VotingBinaryHoleFillFloodingImageFilter);
45 
51 
53  itkNewMacro(Self);
54 
57 
58  using InputImageType = typename Superclass::InputImageType;
59  using InputImagePointer = typename InputImageType::Pointer;
60  using InputImageConstPointer = typename InputImageType::ConstPointer;
62  using InputImagePixelType = typename InputImageType::PixelType;
65 
66  using OutputImageType = typename Superclass::OutputImageType;
67  using OutputImagePointer = typename OutputImageType::Pointer;
69  using OutputImagePixelType = typename OutputImageType::PixelType;
70 
71  using InputSizeType = typename Superclass::InputSizeType;
72 
74  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
75  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
76 
83  itkGetConstReferenceMacro( MajorityThreshold, unsigned int );
84  itkSetMacro( MajorityThreshold, unsigned int );
86 
89  itkSetMacro( MaximumNumberOfIterations, unsigned int );
90  itkGetMacro( MaximumNumberOfIterations, unsigned int );
92 
94  itkGetMacro( CurrentIterationNumber, unsigned int );
95 
97  itkGetMacro( TotalNumberOfPixelsChanged, unsigned int );
98 
99 
100 #ifdef ITK_USE_CONCEPT_CHECKING
101 
102  itkConceptMacro(OutputEqualityComparableCheck, (Concept::EqualityComparable<OutputImagePixelType>));
103  itkConceptMacro(InputEqualityComparableCheck, (Concept::EqualityComparable<InputImagePixelType>));
108 
110 #endif
111 
112 protected:
115 
116  void GenerateData() override;
117 
118  void PrintSelf ( std::ostream& os, Indent indent ) const override;
119 
120 private:
121  void AllocateOutputImageWorkingMemory();
122 
123  void InitializeNeighborhood();
124 
125  void FindAllPixelsInTheBoundaryAndAddThemAsSeeds();
126 
127  void IterateFrontPropagations();
128 
129  void VisitAllSeedsAndTransitionTheirState();
130 
131  void PasteNewSeedValuesToOutputImage();
132 
133  void SwapSeedArrays();
134 
135  void ClearSecondSeedArray();
136 
137  bool TestForQuorumAtCurrentPixel() const;
138 
139  void PutCurrentPixelNeighborsIntoSeedArray();
140 
141  void ComputeArrayOfNeighborhoodBufferOffsets();
142 
143  void ComputeBirthThreshold();
144 
145  unsigned int GetNeighborhoodSize() const;
146 
147  itkSetMacro( CurrentPixelIndex, IndexType );
148  itkGetConstReferenceMacro( CurrentPixelIndex, IndexType );
149 
150  unsigned int m_MajorityThreshold;
151 
152  using SeedArrayType = std::vector<IndexType>;
153 
156 
158 
159  using SeedNewValuesArrayType = std::vector<OutputImagePixelType>;
160 
162 
167 
169 
170  //
171  // Variables used for addressing the Neighbors.
172  // This could be factorized into a helper class.
173  //
174  OffsetValueType m_OffsetTable[ InputImageDimension + 1 ];
175 
176  using NeighborOffsetArrayType = std::vector< OffsetValueType >;
177 
179 
180 
181  //
182  // Helper cache variables
183  //
186 
189 
191 
193 
195 };
196 
197 } // end namespace itk
198 
199 #ifndef ITK_MANUAL_INSTANTIATION
200 #include "itkVotingBinaryHoleFillFloodingImageFilter.hxx"
201 #endif
202 
203 #endif
typename OutputImageType::Pointer OutputImagePointer
Perform front-propagation under a quorum sensing (voting) algorithm for filling holes in a binary mas...
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
typename InputImageType::SizeType InputSizeType
typename OutputImageType::PixelType OutputImagePixelType
typename InputImageType::PixelType InputImagePixelType
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Applies a voting operation in a neighborhood of each pixel.
#define itkConceptMacro(name, concept)
typename InputImageType::ConstPointer InputImageConstPointer
signed long OffsetValueType
Definition: itkIntTypes.h:94
Templated n-dimensional image class.
Definition: itkImage.h:75