OTB  7.2.0
Orfeo Toolbox
otbLabelizeImageFilterBase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2020 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 
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 
89  typedef typename ThresholdFilterType::Pointer ThresholdFilterPointerType;
90 
92  typedef typename MultiplyFilterType::Pointer MultiplyFilterPointerType;
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 
113  RegionGrowingFilterPointerType m_RegionGrowingFilter;
114 
116  InputPixelType m_LowerThreshold;
117 
119  InputPixelType m_UpperThreshold;
120 
122  PointSetPointerType m_PointSet;
123 
125  MultiplyFilterPointerType m_MultiplyFilter;
126 
128  ThresholdFilterPointerType m_ThresholdPointSetFilter;
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
otb::MultiplyByScalarImageFilter< InputImageType, OutputImageType > MultiplyFilterType
itk::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:133
itk::SmartPointer< const Self > ConstPointer
virtual void RegionGrowing(const IndexType)
itk::PointSet< InputPixelType, 2 > PointSetType
RegionGrowingFilterPointerType m_RegionGrowingFilter
MultiplyFilterType::Pointer MultiplyFilterPointerType
otb::ThresholdImageToPointSetFilter< InputImageType, PointSetType > ThresholdFilterType
itk::AddImageFilter< OutputImageType, OutputImageType, OutputImageType > AddImageFilterType
Base class for filter labelizing image region based on segmentation.
AddImageFilterType::Pointer AddImageFilterPointerType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
TOutputImage::PixelType OutputPixelType
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
ThresholdFilterPointerType m_ThresholdPointSetFilter
Produce a PointSet according to filtering conditions.
ThresholdFilterType::Pointer ThresholdFilterPointerType
MultiplyFilterPointerType m_MultiplyFilter