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"
27 #include "itkPadLabelMapFilter.h"
28 
29 
30 namespace itk
31 {
32 
79 template <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>
86 class ITK_TEMPLATE_EXPORT ObjectByObjectLabelMapFilter : public LabelMapFilter<TInputImage, TOutputImage>
87 {
88 public:
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;
111 
112  using InputFilterType = TInputFilter;
113  using OutputFilterType = TOutputFilter;
114 
115  using InternalInputImageType = TInternalInputImage;
119  using InternalOffsetType = typename InternalInputImageType::OffsetType;
120  using InternalInputPixelType = typename InternalInputImageType::PixelType;
121 
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);
140  {
141  return this->m_InputFilter;
142  }
143 
144  const InputFilterType *
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 
210 protected:
212  ~ObjectByObjectLabelMapFilter() override = default;
213  void
214  PrintSelf(std::ostream & os, Indent indent) const override;
215 
216  void
217  GenerateData() override;
218 
219 private:
220  bool m_ConstrainPaddingToImage{};
221  SizeType m_PadSize{};
222  bool m_BinaryInternalOutput{};
223 
224  bool m_KeepLabels{};
225 
226  InternalOutputPixelType m_InternalForegroundValue{};
227 
229  typename SelectType::Pointer m_Select{};
230 
232  typename CropType::Pointer m_Crop{};
233 
235  typename PadType::Pointer m_Pad{};
236 
238  typename LM2BIType::Pointer m_LM2BI{};
239 
241  typename LI2LMType::Pointer m_LI2LM{};
242 
244  typename BI2LMType::Pointer m_BI2LM{};
245 
246  typename InputFilterType::Pointer m_InputFilter{};
247  typename OutputFilterType::Pointer m_OutputFilter{};
248 
249 
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
itkLabelImageToLabelMapFilter.h
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::LabelMapFilter::OutputImageConstPointer
typename OutputImageType::ConstPointer OutputImageConstPointer
Definition: itkLabelMapFilter.h:84
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::ObjectByObjectLabelMapFilter
ObjectByObjectLabelMapFilter applies an image pipeline to all the objects of a label map and produce ...
Definition: itkObjectByObjectLabelMapFilter.h:86
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::ObjectByObjectLabelMapFilter::InternalOffsetType
typename InternalInputImageType::OffsetType InternalOffsetType
Definition: itkObjectByObjectLabelMapFilter.h:119
itk::PadLabelMapFilter
Pad a LabelMap image.
Definition: itkPadLabelMapFilter.h:55
itk::ObjectByObjectLabelMapFilter::InternalSizeType
typename InternalInputImageType::SizeType InternalSizeType
Definition: itkObjectByObjectLabelMapFilter.h:117
itk::LabelMapToBinaryImageFilter
Convert a LabelMap to a binary image.
Definition: itkLabelMapToBinaryImageFilter.h:45
itk::LabelSelectionLabelMapFilter
remove the objects according to the value of their attribute
Definition: itkLabelSelectionLabelMapFilter.h:54
itk::ObjectByObjectLabelMapFilter::GetFilter
InputFilterType * GetFilter()
Definition: itkObjectByObjectLabelMapFilter.h:139
itk::LabelImageToLabelMapFilter
convert a labeled image to a label collection image
Definition: itkLabelImageToLabelMapFilter.h:49
itk::ObjectByObjectLabelMapFilter::GetFilter
const InputFilterType * GetFilter() const
Definition: itkObjectByObjectLabelMapFilter.h:145
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::AutoCropLabelMapFilter
Crop a LabelMap image to fit exactly the objects in the LabelMap.
Definition: itkAutoCropLabelMapFilter.h:53
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ObjectByObjectLabelMapFilter::InternalInputPixelType
typename InternalInputImageType::PixelType InternalInputPixelType
Definition: itkObjectByObjectLabelMapFilter.h:120
itk::LabelMapFilter::LabelObjectType
typename InputImageType::LabelObjectType LabelObjectType
Definition: itkLabelMapFilter.h:80
itk::BinaryImageToLabelMapFilter
Label the connected components in a binary image and produce a collection of label objects.
Definition: itkBinaryImageToLabelMapFilter.h:55
itkLabelMapFilter.h
itk::ObjectByObjectLabelMapFilter::InternalRegionType
typename InternalInputImageType::RegionType InternalRegionType
Definition: itkObjectByObjectLabelMapFilter.h:116
itk::ImageToImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageToImageFilter.h:133
itkLabelSelectionLabelMapFilter.h
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::ObjectByObjectLabelMapFilter::InternalIndexType
typename InternalInputImageType::IndexType InternalIndexType
Definition: itkObjectByObjectLabelMapFilter.h:118
itkPadLabelMapFilter.h
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::ObjectByObjectLabelMapFilter::OutputFilterType
TOutputFilter OutputFilterType
Definition: itkObjectByObjectLabelMapFilter.h:113
itkAutoCropLabelMapFilter.h
itk::LabelMapFilter
Base class for filters that take an image as input and overwrite that image as the output.
Definition: itkLabelMapFilter.h:57
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ObjectByObjectLabelMapFilter::InternalInputImageType
TInternalInputImage InternalInputImageType
Definition: itkObjectByObjectLabelMapFilter.h:115
itk::ObjectByObjectLabelMapFilter::InternalOutputPixelType
typename InternalOutputImageType::PixelType InternalOutputPixelType
Definition: itkObjectByObjectLabelMapFilter.h:123
itkLabelMapToBinaryImageFilter.h
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkBinaryImageToLabelMapFilter.h
itk::ObjectByObjectLabelMapFilter::InternalOutputImageType
TInternalOutputImage InternalOutputImageType
Definition: itkObjectByObjectLabelMapFilter.h:122
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itk::ObjectByObjectLabelMapFilter::InputFilterType
TInputFilter InputFilterType
Definition: itkObjectByObjectLabelMapFilter.h:112
itk::ObjectByObjectLabelMapFilter::LabelMapType
OutputImageType LabelMapType
Definition: itkObjectByObjectLabelMapFilter.h:109
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
Label
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
Superclass
BinaryGeneratorImageFilter< TInputImage1, TInputImage2, TOutputImage > Superclass
Definition: itkAddImageFilter.h:90
itk::ImageToImageFilter::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkImageToImageFilter.h:131
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::ObjectByObjectLabelMapFilter::SizeType
typename OutputImageType::SizeType SizeType
Definition: itkObjectByObjectLabelMapFilter.h:108