ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkBinaryImageToLabelMapFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 =
56  LabelMap< LabelObject< SizeValueType, TInputImage::ImageDimension > > >
57 class ITK_TEMPLATE_EXPORT BinaryImageToLabelMapFilter:
58  public ImageToImageFilter< TInputImage, TOutputImage >
59  , protected ScanlineFilterCommon< TInputImage, TOutputImage >
60 {
61 public:
62  ITK_DISALLOW_COPY_AND_ASSIGN(BinaryImageToLabelMapFilter);
63 
71  using Superclass::Register;
72  using Superclass::UnRegister;
73 
77  itkNewMacro(Self);
78 
83 
87  using InputImagePointer = typename Superclass::InputImagePointer;
88 
93  using OutputPixelType = typename TOutputImage::PixelType;
94  using InputPixelType = typename TInputImage::PixelType;
97  static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
98  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
99  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
100 
104  using InputImageType = TInputImage;
106  using SizeType = typename TInputImage::SizeType;
107  using OffsetType = typename TInputImage::OffsetType;
108 
109  using OutputImageType = TOutputImage;
113  using OutputOffsetType = typename TOutputImage::OffsetType;
114  using OutputImagePixelType = typename TOutputImage::PixelType;
115 
122  itkSetMacro(FullyConnected, bool);
123  itkGetConstReferenceMacro(FullyConnected, bool);
124  itkBooleanMacro(FullyConnected);
126 
127  // only set after completion
128  itkGetConstReferenceMacro(NumberOfObjects, SizeValueType);
129 
134  itkSetMacro(OutputBackgroundValue, OutputPixelType);
135  itkGetConstMacro(OutputBackgroundValue, OutputPixelType);
137 
142  itkSetMacro(InputForegroundValue, InputPixelType);
143  itkGetConstMacro(InputForegroundValue, InputPixelType);
145 
146 protected:
148  ~BinaryImageToLabelMapFilter() override = default;
149  void PrintSelf(std::ostream & os, Indent indent) const override;
150 
151  void DynamicThreadedGenerateData( const RegionType & outputRegionForThread ) override;
152 
153  void GenerateData() override;
154 
158  void GenerateInputRequestedRegion() override;
159 
164  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) ) override;
165 
167 
180 
181 private:
185 };
186 } // end namespace itk
187 
188 #ifndef ITK_MANUAL_INSTANTIATION
189 #if !defined( ITK_WRAPPING_PARSER )
190 #include "itkBinaryImageToLabelMapFilter.hxx"
191 #endif
192 #endif
193 
194 #endif
typename TInputImage::SizeValueType SizeValueType
typename TOutputImage::PixelType OutputPixelType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
typename TOutputImage::IndexType OutputIndexType
typename LineEncodingType::iterator LineEncodingIterator
std::vector< RunLength > LineEncodingType
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 ScanlineFunctions::WorkUnitData WorkUnitData
typename TInputImage::OffsetValueType OffsetValueType
Helper class for a group of filters which operate on scan-lines.
typename TOutputImage::OffsetType OutputOffsetType
typename OutputImageType::PixelType OutputImagePixelType
typename InputImageType::Pointer InputImagePointer
typename OffsetVectorType::const_iterator OffsetVectorConstIterator
TOutputImage OutputImageType
typename TInputImage::OffsetType OffsetType
typename ScanlineFunctions::RunLength RunLength
typename TOutputImage::RegionType::SizeType OutSizeType
std::vector< OutputPixelType > ConsecutiveVectorType
Label the connected components in a binary image and produce a collection of label objects...
std::vector< OffsetValueType > OffsetVectorType
typename TOutputImage::SizeType OutputSizeType
Base class for filters that take an image as input and produce an image as output.
std::vector< LineEncodingType > LineMapType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename TInputImage::SizeType SizeType
typename LineEncodingType::const_iterator LineEncodingConstIterator
typename TInputImage::PixelType InputPixelType
signed long OffsetValueType
Definition: itkIntTypes.h:94
typename TInputImage::IndexType IndexType
Base class for all data objects in ITK.
std::vector< InternalLabelType > UnionFindType