ITK  6.0.0
Insight Toolkit
itkConnectedComponentImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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 itkConnectedComponentImageFilter_h
19#define itkConnectedComponentImageFilter_h
20
22
23namespace itk
24{
58template <typename TInputImage, typename TOutputImage, typename TMaskImage = TInputImage>
59class ITK_TEMPLATE_EXPORT ConnectedComponentImageFilter
60 : public ImageToImageFilter<TInputImage, TOutputImage>
61 , protected ScanlineFilterCommon<TInputImage, TOutputImage>
62{
63public:
64 ITK_DISALLOW_COPY_AND_MOVE(ConnectedComponentImageFilter);
65
69 using Self = ConnectedComponentImageFilter;
70 using Superclass = ImageToImageFilter<TInputImage, TOutputImage>;
71 using Superclass::Register;
72 using Superclass::UnRegister;
73
77 using typename Superclass::InputImagePointer;
78
83 using OutputPixelType = typename TOutputImage::PixelType;
84 using OutputInternalPixelType = typename TOutputImage::InternalPixelType;
85 using InputPixelType = typename TInputImage::PixelType;
86 using InputInternalPixelType = typename TInputImage::InternalPixelType;
87 using MaskPixelType = typename TMaskImage::PixelType;
88 static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
89 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
90 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
91
95 using InputImageType = TInputImage;
96 using MaskImageType = TMaskImage;
98 using SizeType = typename TInputImage::SizeType;
99 using OffsetType = typename TInputImage::OffsetType;
101 using OutputImageType = TOutputImage;
105 using OutputOffsetType = typename TOutputImage::OffsetType;
106 using OutputImagePixelType = typename TOutputImage::PixelType;
108 using ListType = std::list<IndexType>;
110
116
120 itkOverrideGetNameOfClassMacro(ConnectedComponentImageFilter);
121
125 itkNewMacro(Self);
126
133 itkSetMacro(FullyConnected, bool);
134 itkGetConstReferenceMacro(FullyConnected, bool);
135 itkBooleanMacro(FullyConnected);
141 // only set after completion
142 itkGetConstReferenceMacro(ObjectCount, LabelType);
143
146 itkSetInputMacro(MaskImage, MaskImageType);
147 itkGetInputMacro(MaskImage, MaskImageType);
148
154 itkSetMacro(BackgroundValue, OutputImagePixelType);
155 itkGetConstMacro(BackgroundValue, OutputImagePixelType);
158protected:
160
161 ~ConnectedComponentImageFilter() override = default;
162 void
163 PrintSelf(std::ostream & os, Indent indent) const override;
165 void
166 GenerateData() override;
168 void
169 DynamicThreadedGenerateData(const RegionType &) override;
171 void
172 ThreadedWriteOutput(const RegionType &);
173
177 void
178 GenerateInputRequestedRegion() override;
179
184 void
185 EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
186
202private:
203 OutputPixelType m_BackgroundValue{};
204 LabelType m_ObjectCount = 0;
205
206 typename TInputImage::ConstPointer m_Input{};
207};
208} // end namespace itk
209
210#ifndef ITK_MANUAL_INSTANTIATION
211# if !defined(ITK_WRAPPING_PARSER)
212# include "itkConnectedComponentImageFilter.hxx"
213# endif
214#endif
215
216#endif
Pixel-wise addition of two images.
Label the objects in a binary image.
typename MaskImageType::Pointer MaskImagePointer
typename ScanlineFunctions::WorkUnitData WorkUnitData
typename TInputImage::InternalPixelType InputInternalPixelType
typename ScanlineFunctions::RunLength RunLength
typename TOutputImage::InternalPixelType OutputInternalPixelType
Base class for all data objects in ITK.
Base class for all process objects that output image data.
typename OutputImageType::PixelType OutputImagePixelType
TOutputImage OutputImageType
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Helper class for a group of filters which operate on scan-lines.
typename TInputImage::IndexType IndexType
typename OffsetVectorType::const_iterator OffsetVectorConstIterator
typename TOutputImage::SizeType OutputSizeType
typename TOutputImage::RegionType::SizeType OutSizeType
typename LineEncodingType::const_iterator LineEncodingConstIterator
typename TInputImage::OffsetType OffsetType
typename LineEncodingType::iterator LineEncodingIterator
std::vector< LineEncodingType > LineMapType
typename TOutputImage::OffsetType OutputOffsetType
std::vector< RunLength > LineEncodingType
typename TInputImage::SizeType SizeType
std::vector< OffsetValueType > OffsetVectorType
std::vector< InternalLabelType > UnionFindType
std::vector< OutputPixelType > ConsecutiveVectorType
typename TOutputImage::IndexType OutputIndexType
typename TInputImage::PixelType InputPixelType
typename TOutputImage::PixelType OutputPixelType
SmartPointer< const Self > ConstPointer
BinaryGeneratorImageFilter< TInputImage1, TInputImage2, TOutputImage > Superclass
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
SizeValueType IdentifierType
Definition: itkIntTypes.h:90