ITK  5.1.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  * http://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 
25 namespace itk
26 {
54 template <typename TInputImage,
55  typename TOutputImage = LabelMap<LabelObject<SizeValueType, TInputImage::ImageDimension>>>
56 class ITK_TEMPLATE_EXPORT BinaryImageToLabelMapFilter
57  : public ImageToImageFilter<TInputImage, TOutputImage>
58  , protected ScanlineFilterCommon<TInputImage, TOutputImage>
59 {
60 public:
61  ITK_DISALLOW_COPY_AND_ASSIGN(BinaryImageToLabelMapFilter);
62 
70  using Superclass::Register;
71  using Superclass::UnRegister;
72 
76  itkNewMacro(Self);
77 
82 
86  using InputImagePointer = typename Superclass::InputImagePointer;
87 
92  using OutputPixelType = typename TOutputImage::PixelType;
93  using InputPixelType = typename TInputImage::PixelType;
96  static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
97  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
98  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
99 
103  using InputImageType = TInputImage;
105  using SizeType = typename TInputImage::SizeType;
106  using OffsetType = typename TInputImage::OffsetType;
107 
108  using OutputImageType = TOutputImage;
112  using OutputOffsetType = typename TOutputImage::OffsetType;
113  using OutputImagePixelType = typename TOutputImage::PixelType;
114 
121  itkSetMacro(FullyConnected, bool);
122  itkGetConstReferenceMacro(FullyConnected, bool);
123  itkBooleanMacro(FullyConnected);
125 
126  // only set after completion
127  itkGetConstReferenceMacro(NumberOfObjects, SizeValueType);
128 
133  itkSetMacro(OutputBackgroundValue, OutputPixelType);
134  itkGetConstMacro(OutputBackgroundValue, OutputPixelType);
136 
141  itkSetMacro(InputForegroundValue, InputPixelType);
142  itkGetConstMacro(InputForegroundValue, InputPixelType);
144 
145 protected:
147  ~BinaryImageToLabelMapFilter() override = default;
148  void
149  PrintSelf(std::ostream & os, Indent indent) const override;
150 
151  void
152  DynamicThreadedGenerateData(const RegionType & outputRegionForThread) override;
153 
154  void
155  GenerateData() override;
156 
160  void
161  GenerateInputRequestedRegion() override;
162 
167  void
168  EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
169 
171 
184 
185 private:
189 };
190 } // end namespace itk
191 
192 #ifndef ITK_MANUAL_INSTANTIATION
193 # if !defined(ITK_WRAPPING_PARSER)
194 # include "itkBinaryImageToLabelMapFilter.hxx"
195 # endif
196 #endif
197 
198 #endif
itk::ScanlineFilterCommon::LineEncodingIterator
typename LineEncodingType::iterator LineEncodingIterator
Definition: itkScanlineFilterCommon.h:129
itk::BinaryImageToLabelMapFilter::RunLength
typename ScanlineFunctions::RunLength RunLength
Definition: itkBinaryImageToLabelMapFilter.h:174
itk::ScanlineFilterCommon::LineMapType
std::vector< LineEncodingType > LineMapType
Definition: itkScanlineFilterCommon.h:135
itk::ScanlineFilterCommon::LineEncodingType
std::vector< RunLength > LineEncodingType
Definition: itkScanlineFilterCommon.h:128
itk::ScanlineFilterCommon::RunLength
Definition: itkScanlineFilterCommon.h:115
itk::ScanlineFilterCommon::OffsetVectorType
std::vector< OffsetValueType > OffsetVectorType
Definition: itkScanlineFilterCommon.h:132
itk::ScanlineFilterCommon::OffsetType
typename TInputImage::OffsetType OffsetType
Definition: itkScanlineFilterCommon.h:88
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkScanlineFilterCommon.h
itk::BinaryImageToLabelMapFilter
Label the connected components in a binary image and produce a collection of label objects.
Definition: itkBinaryImageToLabelMapFilter.h:56
itk::ScanlineFilterCommon::OutputPixelType
typename TOutputImage::PixelType OutputPixelType
Definition: itkScanlineFilterCommon.h:78
itk::ScanlineFilterCommon::UnionFindType
std::vector< InternalLabelType > UnionFindType
Definition: itkScanlineFilterCommon.h:137
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itkLabelMap.h
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::BinaryImageToLabelMapFilter::SizeValueType
typename TInputImage::SizeValueType SizeValueType
Definition: itkBinaryImageToLabelMapFilter.h:94
itk::ScanlineFilterCommon::InternalLabelType
SizeValueType InternalLabelType
Definition: itkScanlineFilterCommon.h:112
itk::ScanlineFilterCommon::WorkUnitData
Definition: itkScanlineFilterCommon.h:453
itk::ScanlineFilterCommon::OutSizeType
typename TOutputImage::RegionType::SizeType OutSizeType
Definition: itkScanlineFilterCommon.h:113
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::BinaryImageToLabelMapFilter::m_InputForegroundValue
InputPixelType m_InputForegroundValue
Definition: itkBinaryImageToLabelMapFilter.h:187
itk::ScanlineFilterCommon::OffsetVectorConstIterator
typename OffsetVectorType::const_iterator OffsetVectorConstIterator
Definition: itkScanlineFilterCommon.h:133
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::BinaryImageToLabelMapFilter::m_OutputBackgroundValue
OutputPixelType m_OutputBackgroundValue
Definition: itkBinaryImageToLabelMapFilter.h:186
itk::ScanlineFilterCommon::ConsecutiveVectorType
std::vector< OutputPixelType > ConsecutiveVectorType
Definition: itkScanlineFilterCommon.h:138
itk::ScanlineFilterCommon::InputPixelType
typename TInputImage::PixelType InputPixelType
Definition: itkScanlineFilterCommon.h:79
itkLabelObject.h
itk::ScanlineFilterCommon::OutputIndexType
typename TOutputImage::IndexType OutputIndexType
Definition: itkScanlineFilterCommon.h:93
itk::BinaryImageToLabelMapFilter::m_NumberOfObjects
SizeValueType m_NumberOfObjects
Definition: itkBinaryImageToLabelMapFilter.h:188
itk::ScanlineFilterCommon::OutputOffsetType
typename TOutputImage::OffsetType OutputOffsetType
Definition: itkScanlineFilterCommon.h:95
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkArray.h:26
itk::ScanlineFilterCommon
Helper class for a group of filters which operate on scan-lines.
Definition: itkScanlineFilterCommon.h:42
itk::OffsetValueType
signed long OffsetValueType
Definition: itkIntTypes.h:94
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::ScanlineFilterCommon::OutputSizeType
typename TOutputImage::SizeType OutputSizeType
Definition: itkScanlineFilterCommon.h:94
itk::ScanlineFilterCommon::LineEncodingConstIterator
typename LineEncodingType::const_iterator LineEncodingConstIterator
Definition: itkScanlineFilterCommon.h:130
itk::BinaryImageToLabelMapFilter::OffsetValueType
typename TInputImage::OffsetValueType OffsetValueType
Definition: itkBinaryImageToLabelMapFilter.h:95
itk::BinaryImageToLabelMapFilter::WorkUnitData
typename ScanlineFunctions::WorkUnitData WorkUnitData
Definition: itkBinaryImageToLabelMapFilter.h:183
itk::ScanlineFilterCommon::IndexType
typename TInputImage::IndexType IndexType
Definition: itkScanlineFilterCommon.h:86
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293
itk::ScanlineFilterCommon::RegionType
OutputRegionType RegionType
Definition: itkScanlineFilterCommon.h:92
itk::ScanlineFilterCommon::SizeType
typename TInputImage::SizeType SizeType
Definition: itkScanlineFilterCommon.h:87