ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkRegionCompetitionImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: itkRegionCompetitionImageFilter.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 itkRegionCompetitionImageFilter_h
18 #define itkRegionCompetitionImageFilter_h
19 
20 #include "itkImage.h"
21 #include "itkImageToImageFilter.h"
22 
23 #include <vector>
24 
25 namespace itk
26 {
27 
40 template <typename TInputImage, typename TOutputImage>
42  public ImageToImageFilter<TInputImage,TOutputImage>
43 {
44 public:
45  ITK_DISALLOW_COPY_AND_ASSIGN(RegionCompetitionImageFilter);
46 
52 
54  itkNewMacro(Self);
55 
58 
59  using InputImageType = TInputImage;
60  using InputImagePointer = typename InputImageType::Pointer;
61  using InputImageConstPointer = typename InputImageType::ConstPointer;
64  using InputImagePixelType = typename InputImageType::PixelType;
67 
68  using OutputImageType = TOutputImage;
69  using OutputImagePointer = typename OutputImageType::Pointer;
71  using OutputImagePixelType = typename OutputImageType::PixelType;
72 
73 
75  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
76  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
77 
80  itkSetMacro( MaximumNumberOfIterations, unsigned int );
81  itkGetMacro( MaximumNumberOfIterations, unsigned int );
83 
85  itkGetMacro( CurrentIterationNumber, unsigned int );
86 
88  itkGetMacro( TotalNumberOfPixelsChanged, unsigned int );
89 
91  void SetInputLabels( const TOutputImage * inputLabelImage );
92 
93 #ifdef ITK_USE_CONCEPT_CHECKING
94 
101 
103 #endif
104 
105 protected:
108 
109  void GenerateData() override;
110 
111  void PrintSelf ( std::ostream& os, Indent indent ) const override;
112 
113 private:
115 
117 
119 
120  void InitializeNeighborhood();
121 
123 
125 
127 
129 
130  void SwapSeedArrays();
131 
132  void ClearSecondSeedArray();
133 
135 
137 
139 
140  void ComputeBirthThreshold();
141 
142  itkSetMacro( CurrentPixelIndex, IndexType );
143  itkGetConstReferenceMacro( CurrentPixelIndex, IndexType );
144 
145  using SeedArrayType = std::vector<IndexType>;
146 
149 
151 
152  using SeedNewValuesArrayType = std::vector<OutputImagePixelType>;
153 
155 
160 
162 
163  //
164  // Variables used for addressing the Neighbors.
165  // This could be factorized into a helper class.
166  //
168 
169  using NeighborOffsetArrayType = std::vector< OffsetValueType >;
170 
172 
173 
174  //
175  // Helper cache variables
176  //
180 
183 
185 
187 
189 
190  mutable unsigned int m_NumberOfLabels;
191 };
192 
193 } // end namespace itk
194 
195 #ifndef ITK_MANUAL_INSTANTIATION
196 #include "itkRegionCompetitionImageFilter.hxx"
197 #endif
198 
199 #endif
typename OutputImageType::Pointer OutputImagePointer
OffsetValueType m_OffsetTable[InputImageDimension+1]
void SetInputLabels(const TOutputImage *inputLabelImage)
std::vector< OffsetValueType > NeighborOffsetArrayType
typename SeedMaskImageType::Pointer SeedMaskImagePointer
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::IndexType IndexType
typename InputImageType::OffsetValueType OffsetValueType
typename OutputImageType::PixelType OutputImagePixelType
typename InputImageType::PixelType InputImagePixelType
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
typename InputImageType::SizeType InputSizeType
void PrintSelf(std::ostream &os, Indent indent) const override
static constexpr unsigned int OutputImageDimension
typename InputImageType::RegionType InputImageRegionType
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Perform front-propagation from different starting labeled regions.
SmartPointer< Self > Pointer
Definition: itkImage.h:83
#define itkConceptMacro(name, concept)
typename InputImageType::ConstPointer InputImageConstPointer
signed long OffsetValueType
Definition: itkIntTypes.h:94
static constexpr unsigned int InputImageDimension
Templated n-dimensional image class.
Definition: itkImage.h:75
bool TestForAvailabilityAtCurrentPixel() const
std::vector< OutputImagePixelType > SeedNewValuesArrayType