OTB  10.0.0
Orfeo Toolbox
otbThresholdVectorImageFilter.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 otbThresholdVectorImageFilter_h
22 #define otbThresholdVectorImageFilter_h
23 
24 #include "itkImageToImageFilter.h"
25 
26 namespace otb
27 {
28 
43 template <class TInputImage, class TOutputImage = TInputImage>
44 class ITK_EXPORT ThresholdVectorImageFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
45 {
46 public:
49  typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
50  typedef itk::SmartPointer<Self> Pointer;
51  typedef itk::SmartPointer<const Self> ConstPointer;
52 
54  itkNewMacro(Self);
55 
57  itkTypeMacro(ThresholdVectorImageFilter, itk::ImageToImageFilter);
58 
59 
61  typedef TInputImage InputImageType;
62  typedef typename InputImageType::ConstPointer InputImagePointer;
63  typedef typename InputImageType::RegionType InputImageRegionType;
64  typedef typename InputImageType::PixelType InputImagePixelType;
65  typedef typename InputImageType::InternalPixelType InputImageInternalPixelType;
66 
68  typedef TOutputImage OutputImageType;
69  typedef typename OutputImageType::Pointer OutputImagePointer;
70  typedef typename OutputImageType::RegionType OutputImageRegionType;
71  typedef typename OutputImageType::PixelType OutputImagePixelType;
72  typedef typename OutputImageType::InternalPixelType OutputImageInternalPixelType;
73 
76  itkSetMacro(OutsideValue, OutputImageInternalPixelType);
77 
79  itkGetConstMacro(OutsideValue, OutputImageInternalPixelType);
80 
82  void ThresholdAbove(const InputImageInternalPixelType& thresh);
83 
85  void ThresholdBelow(const InputImageInternalPixelType& thresh);
86 
88  void ThresholdOutside(const InputImageInternalPixelType& lower, const InputImageInternalPixelType& upper);
89 
91  itkSetMacro(Lower, InputImageInternalPixelType);
92  itkGetConstMacro(Lower, InputImageInternalPixelType);
94 
96  itkSetMacro(Upper, InputImageInternalPixelType);
97  itkGetConstMacro(Upper, InputImageInternalPixelType);
99 
100 
101 protected:
104  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
105 
116  void DynamicThreadedGenerateData(const OutputImageRegionType& outputRegionForThread) override;
117 
118  void GenerateOutputInformation(void) override
119  {
120  Superclass::GenerateOutputInformation();
121 
122  this->GetOutput()->SetNumberOfComponentsPerPixel(this->GetInput()->GetNumberOfComponentsPerPixel());
123  }
124 
125 private:
127  void operator=(const Self&) = delete;
128 
132 };
133 
134 
135 } // end namespace otb
136 
137 #ifndef OTB_MANUAL_INSTANTIATION
139 #endif
140 
141 #endif
Set image values to a user-specified value if they are below, above, or between simple threshold valu...
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
InputImageType::InternalPixelType InputImageInternalPixelType
itk::SmartPointer< const Self > ConstPointer
OutputImageType::PixelType OutputImagePixelType
OutputImageType::InternalPixelType OutputImageInternalPixelType
InputImageType::RegionType InputImageRegionType
void operator=(const Self &)=delete
ThresholdVectorImageFilter(const Self &)=delete
InputImageType::ConstPointer InputImagePointer
OutputImageType::RegionType OutputImageRegionType
OutputImageInternalPixelType m_OutsideValue
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.