OTB  10.0.0
Orfeo Toolbox
otbLabelizeImageFilterBase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbLabelizeImageFilterBase_h
22 #define otbLabelizeImageFilterBase_h
23 
24 #include "itkImageToImageFilter.h"
25 #include "itkAddImageFilter.h"
26 
29 
30 namespace otb
31 {
38 template <class TInputImage, class TOutputImage, class TFilter>
39 class ITK_EXPORT LabelizeImageFilterBase : public itk::ImageToImageFilter<TInputImage, TOutputImage>
40 {
41 public:
44  typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
45  typedef itk::SmartPointer<Self> Pointer;
46  typedef itk::SmartPointer<const Self> ConstPointer;
47 
49  typedef TInputImage InputImageType;
50  typedef TOutputImage OutputImageType;
51 
52  typedef typename TInputImage::PixelType InputPixelType;
53  typedef typename TOutputImage::PixelType OutputPixelType;
54 
55  typedef typename TInputImage::IndexType IndexType;
56 
57  typedef itk::PointSet<InputPixelType, 2> PointSetType;
58  typedef typename PointSetType::Pointer PointSetPointerType;
59 
60  typedef TFilter RegionGrowingFilterType;
61  typedef typename TFilter::Pointer RegionGrowingFilterPointerType;
62 
64  itkNewMacro(Self);
65 
67  itkTypeMacro(LabelizeImageFilterBase, ImageToImageFilter);
68 
70  itkGetMacro(LowerThreshold, InputPixelType);
71 
73  itkSetMacro(LowerThreshold, InputPixelType);
74 
76  itkGetMacro(UpperThreshold, InputPixelType);
77 
79  itkSetMacro(UpperThreshold, InputPixelType);
80 
82  // only set after completion
83  // itkGetConstReferenceMacro(ObjectCount, unsigned long);
84  itkGetMacro(ObjectCount, unsigned long);
86 
90 
93 
94  typedef itk::AddImageFilter<OutputImageType, OutputImageType, OutputImageType> AddImageFilterType;
95  typedef typename AddImageFilterType::Pointer AddImageFilterPointerType;
96 
97 protected:
100  {
101  }
102  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
103 
105  void GenerateData() override;
106 
108  virtual void RegionGrowing(const IndexType itkNotUsed(indexSeed))
109  {
110  }
111 
114 
117 
120 
123 
126 
129 
131  unsigned long m_ObjectCount;
132 
133 private:
134  LabelizeImageFilterBase(const Self&) = delete;
135  void operator=(const Self&) = delete;
136 
137 }; // end class LabelizeImageFilterBase
138 
139 } // end namespace otb
140 
141 #ifndef OTB_MANUAL_INSTANTIATION
143 #endif
144 
145 #endif
Base class for filter labelizing image region based on segmentation.
MultiplyFilterType::Pointer MultiplyFilterPointerType
otb::ThresholdImageToPointSetFilter< InputImageType, PointSetType > ThresholdFilterType
virtual void RegionGrowing(const IndexType)
LabelizeImageFilterBase(const Self &)=delete
RegionGrowingFilterPointerType m_RegionGrowingFilter
ThresholdFilterType::Pointer ThresholdFilterPointerType
ThresholdFilterPointerType m_ThresholdPointSetFilter
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
MultiplyFilterPointerType m_MultiplyFilter
itk::PointSet< InputPixelType, 2 > PointSetType
AddImageFilterType::Pointer AddImageFilterPointerType
TOutputImage::PixelType OutputPixelType
otb::MultiplyByScalarImageFilter< InputImageType, OutputImageType > MultiplyFilterType
itk::AddImageFilter< OutputImageType, OutputImageType, OutputImageType > AddImageFilterType
itk::SmartPointer< const Self > ConstPointer
void operator=(const Self &)=delete
Produce a PointSet according to filtering conditions.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.