ITK  6.0.0
Insight Toolkit
itkBinaryImageToLabelMapFilter.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 itkBinaryImageToLabelMapFilter_h
19#define itkBinaryImageToLabelMapFilter_h
20
22#include "itkLabelMap.h"
23#include "itkLabelObject.h"
24
25namespace itk
26{
53template <typename TInputImage,
54 typename TOutputImage = LabelMap<LabelObject<SizeValueType, TInputImage::ImageDimension>>>
55class ITK_TEMPLATE_EXPORT BinaryImageToLabelMapFilter
56 : public ImageToImageFilter<TInputImage, TOutputImage>
57 , protected ScanlineFilterCommon<TInputImage, TOutputImage>
58{
59public:
60 ITK_DISALLOW_COPY_AND_MOVE(BinaryImageToLabelMapFilter);
61
69 using Superclass::Register;
70 using Superclass::UnRegister;
71
75 itkNewMacro(Self);
76
80 itkOverrideGetNameOfClassMacro(BinaryImageToLabelMapFilter);
81
85 using typename Superclass::InputImagePointer;
86
91 using OutputPixelType = typename TOutputImage::PixelType;
92 using InputPixelType = typename TInputImage::PixelType;
95 static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
96 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
97 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
98
102 using InputImageType = TInputImage;
105 using OffsetType = typename TInputImage::OffsetType;
106
107 using OutputImageType = TOutputImage;
111 using OutputOffsetType = typename TOutputImage::OffsetType;
112 using OutputImagePixelType = typename TOutputImage::PixelType;
113
120 itkSetMacro(FullyConnected, bool);
121 itkGetConstReferenceMacro(FullyConnected, bool);
122 itkBooleanMacro(FullyConnected);
125 // only set after completion
126 itkGetConstReferenceMacro(NumberOfObjects, SizeValueType);
127
132 itkSetMacro(OutputBackgroundValue, OutputPixelType);
133 itkGetConstMacro(OutputBackgroundValue, OutputPixelType);
140 itkSetMacro(InputForegroundValue, InputPixelType);
141 itkGetConstMacro(InputForegroundValue, InputPixelType);
144protected:
146 ~BinaryImageToLabelMapFilter() override = default;
147 void
148 PrintSelf(std::ostream & os, Indent indent) const override;
149
150 void
151 DynamicThreadedGenerateData(const RegionType & outputRegionForThread) override;
152
153 void
154 GenerateData() override;
155
159 void
161
166 void
167 EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
168
170
183
184private:
185 OutputPixelType m_OutputBackgroundValue{};
186 InputPixelType m_InputForegroundValue{};
187 SizeValueType m_NumberOfObjects{};
188};
189} // end namespace itk
190
191#ifndef ITK_MANUAL_INSTANTIATION
192# if !defined(ITK_WRAPPING_PARSER)
193# include "itkBinaryImageToLabelMapFilter.hxx"
194# endif
195#endif
196
197#endif
Label the connected components in a binary image and produce a collection of label objects.
typename ScanlineFunctions::WorkUnitData WorkUnitData
void PrintSelf(std::ostream &os, Indent indent) const override
typename ScanlineFunctions::ConsecutiveVectorType ConsecutiveVectorType
typename TInputImage::PixelType InputPixelType
typename TOutputImage::PixelType OutputPixelType
typename TOutputImage::PixelType OutputImagePixelType
typename TOutputImage::IndexType OutputIndexType
typename ScanlineFunctions::InternalLabelType InternalLabelType
typename ScanlineFunctions::UnionFindType UnionFindType
typename TInputImage::SizeValueType SizeValueType
typename TOutputImage::OffsetType OutputOffsetType
typename TInputImage::OffsetValueType OffsetValueType
typename TInputImage::OffsetType OffsetType
typename ScanlineFunctions::OffsetVectorConstIterator OffsetVectorConstIterator
typename ScanlineFunctions::LineEncodingType LineEncodingType
typename ScanlineFunctions::LineEncodingIterator LineEncodingIterator
typename TOutputImage::RegionType RegionType
~BinaryImageToLabelMapFilter() override=default
void DynamicThreadedGenerateData(const RegionType &outputRegionForThread) override
typename ScanlineFunctions::OutSizeType OutSizeType
typename ScanlineFunctions::RunLength RunLength
typename TOutputImage::SizeType OutputSizeType
void GenerateInputRequestedRegion() override
typename TInputImage::IndexType IndexType
typename ScanlineFunctions::LineMapType LineMapType
typename ScanlineFunctions::LineEncodingConstIterator LineEncodingConstIterator
typename ScanlineFunctions::OffsetVectorType OffsetVectorType
void EnlargeOutputRequestedRegion(DataObject *) override
Base class for all data objects in ITK.
Base class for filters that take an image as input and produce an image as output.
typename InputImageType::Pointer InputImagePointer
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Helper class for a group of filters which operate on scan-lines.
typename OffsetVectorType::const_iterator OffsetVectorConstIterator
typename TOutputImage::RegionType::SizeType OutSizeType
typename LineEncodingType::const_iterator LineEncodingConstIterator
typename LineEncodingType::iterator LineEncodingIterator
std::vector< LineEncodingType > LineMapType
std::vector< RunLength > LineEncodingType
std::vector< OffsetValueType > OffsetVectorType
std::vector< InternalLabelType > UnionFindType
std::vector< OutputPixelType > ConsecutiveVectorType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:86
long OffsetValueType
Definition: itkIntTypes.h:97