ITK  6.0.0
Insight Toolkit
itkObjectByObjectLabelMapFilter.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 itkObjectByObjectLabelMapFilter_h
19#define itkObjectByObjectLabelMapFilter_h
20
21#include "itkLabelMapFilter.h"
28
29
30namespace itk
31{
32
79template <typename TInputImage,
80 typename TOutputImage = TInputImage,
81 typename TInputFilter = ImageToImageFilter<Image<unsigned char, TInputImage::ImageDimension>,
82 Image<unsigned char, TOutputImage::ImageDimension>>,
83 class TOutputFilter = typename TInputFilter::Superclass,
84 class TInternalInputImage = typename TInputFilter::InputImageType,
85 class TInternalOutputImage = typename TOutputFilter::OutputImageType>
86class ITK_TEMPLATE_EXPORT ObjectByObjectLabelMapFilter : public LabelMapFilter<TInputImage, TOutputImage>
87{
88public:
89 ITK_DISALLOW_COPY_AND_MOVE(ObjectByObjectLabelMapFilter);
90
96
98 using InputImageType = TInputImage;
99 using OutputImageType = TOutputImage;
103 using InputImagePixelType = typename InputImageType::PixelType;
107 using OutputImagePixelType = typename OutputImageType::PixelType;
110 using LabelObjectType = typename LabelMapType::LabelObjectType;
112 using InputFilterType = TInputFilter;
113 using OutputFilterType = TOutputFilter;
115 using InternalInputImageType = TInternalInputImage;
119 using InternalOffsetType = typename InternalInputImageType::OffsetType;
120 using InternalInputPixelType = typename InternalInputImageType::PixelType;
122 using InternalOutputImageType = TInternalOutputImage;
123 using InternalOutputPixelType = typename InternalOutputImageType::PixelType;
124
126 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
127 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
128 static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
129
131 itkNewMacro(Self);
132
134 itkOverrideGetNameOfClassMacro(ObjectByObjectLabelMapFilter);
135
136 void
137 SetFilter(InputFilterType * filter);
139 GetFilter()
140 {
141 return this->m_InputFilter;
142 }
143
145 GetFilter() const
146 {
147 return this->m_InputFilter;
148 }
149
150 void
151 SetInputFilter(InputFilterType * filter);
152 itkGetModifiableObjectMacro(InputFilter, InputFilterType);
153
154 void
155 SetOutputFilter(OutputFilterType * filter);
156 itkGetModifiableObjectMacro(OutputFilter, OutputFilterType);
157
165 itkSetMacro(KeepLabels, bool);
166 itkGetMacro(KeepLabels, bool);
167 itkBooleanMacro(KeepLabels);
173 itkSetMacro(PadSize, SizeType);
174 itkGetMacro(PadSize, SizeType);
181 itkSetMacro(ConstrainPaddingToImage, bool);
182 itkGetMacro(ConstrainPaddingToImage, bool);
183 itkBooleanMacro(ConstrainPaddingToImage);
191 itkSetMacro(BinaryInternalOutput, bool);
192 itkGetMacro(BinaryInternalOutput, bool);
193 itkBooleanMacro(BinaryInternalOutput);
200 itkSetMacro(InternalForegroundValue, InternalOutputPixelType);
201 itkGetMacro(InternalForegroundValue, InternalOutputPixelType);
208 itkGetMacro(Label, InputImagePixelType);
209
210protected:
212 ~ObjectByObjectLabelMapFilter() override = default;
213 void
214 PrintSelf(std::ostream & os, Indent indent) const override;
215
216 void
217 GenerateData() override;
218
219private:
220 bool m_ConstrainPaddingToImage{};
221 SizeType m_PadSize{};
222 bool m_BinaryInternalOutput{};
224 bool m_KeepLabels{};
226 InternalOutputPixelType m_InternalForegroundValue{};
229 typename SelectType::Pointer m_Select{};
232 typename CropType::Pointer m_Crop{};
235 typename PadType::Pointer m_Pad{};
238 typename LM2BIType::Pointer m_LM2BI{};
241 typename LI2LMType::Pointer m_LI2LM{};
244 typename BI2LMType::Pointer m_BI2LM{};
246 typename InputFilterType::Pointer m_InputFilter{};
247 typename OutputFilterType::Pointer m_OutputFilter{};
248
250 InputImagePixelType m_Label{};
251
252}; // end of class
253
254} // end namespace itk
255
256#ifndef ITK_MANUAL_INSTANTIATION
257# include "itkObjectByObjectLabelMapFilter.hxx"
258#endif
259
260#endif
Crop a LabelMap image to fit exactly the objects in the LabelMap.
Label the connected components in a binary image and produce a collection of label objects.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
convert a labeled image to a label collection image
Base class for filters that take an image as input and overwrite that image as the output.
Convert a LabelMap to a binary image.
remove the objects according to the value of their attribute
Light weight base class for most itk classes.
ObjectByObjectLabelMapFilter applies an image pipeline to all the objects of a label map and produce ...
typename InternalInputImageType::RegionType InternalRegionType
typename InputImageType::RegionType InputImageRegionType
typename InternalInputImageType::PixelType InternalInputPixelType
typename OutputImageType::ConstPointer OutputImageConstPointer
typename OutputImageType::SizeType SizeType
typename OutputImageType::RegionType OutputImageRegionType
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::PixelType OutputImagePixelType
typename InputImageType::ConstPointer InputImageConstPointer
typename InternalInputImageType::SizeType InternalSizeType
typename OutputImageType::Pointer OutputImagePointer
typename LabelMapType::LabelObjectType LabelObjectType
typename InternalInputImageType::OffsetType InternalOffsetType
typename InternalInputImageType::IndexType InternalIndexType
typename InternalOutputImageType::PixelType InternalOutputPixelType
typename InputImageType::PixelType InputImagePixelType
Pad a LabelMap image.
SmartPointer< const Self > ConstPointer
BinaryGeneratorImageFilter< TInputImage1, TInputImage2, TOutputImage > Superclass
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....