OTB  9.0.0
Orfeo Toolbox
otbThresholdVectorImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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 ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType ThrethreadId) override;
117 
118  void GenerateOutputInformation(void) override
119  {
120  Superclass::GenerateOutputInformation();
121 
122  this->GetOutput()->SetNumberOfComponentsPerPixel(this->GetInput()->GetNumberOfComponentsPerPixel());
123  }
124 
125 private:
126  ThresholdVectorImageFilter(const Self&) = delete;
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
otb::ThresholdVectorImageFilter::OutputImagePixelType
OutputImageType::PixelType OutputImagePixelType
Definition: otbThresholdVectorImageFilter.h:71
otb::ThresholdVectorImageFilter::m_OutsideValue
OutputImageInternalPixelType m_OutsideValue
Definition: otbThresholdVectorImageFilter.h:129
otb::ThresholdVectorImageFilter::OutputImagePointer
OutputImageType::Pointer OutputImagePointer
Definition: otbThresholdVectorImageFilter.h:69
otb::ThresholdVectorImageFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbThresholdVectorImageFilter.h:68
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otbThresholdVectorImageFilter.hxx
otb::ThresholdVectorImageFilter::m_Upper
InputImageInternalPixelType m_Upper
Definition: otbThresholdVectorImageFilter.h:131
otb::ThresholdVectorImageFilter::Superclass
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
Definition: otbThresholdVectorImageFilter.h:49
otb::ThresholdVectorImageFilter::m_Lower
InputImageInternalPixelType m_Lower
Definition: otbThresholdVectorImageFilter.h:130
otb::ThresholdVectorImageFilter::InputImageInternalPixelType
InputImageType::InternalPixelType InputImageInternalPixelType
Definition: otbThresholdVectorImageFilter.h:65
otb::ThresholdVectorImageFilter::OutputImageRegionType
OutputImageType::RegionType OutputImageRegionType
Definition: otbThresholdVectorImageFilter.h:70
otb::ThresholdVectorImageFilter
Set image values to a user-specified value if they are below, above, or between simple threshold valu...
Definition: otbThresholdVectorImageFilter.h:44
otb::ThresholdVectorImageFilter::~ThresholdVectorImageFilter
~ThresholdVectorImageFilter() override
Definition: otbThresholdVectorImageFilter.h:103
otb::ThresholdVectorImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbThresholdVectorImageFilter.h:50
otb::ThresholdVectorImageFilter::OutputImageInternalPixelType
OutputImageType::InternalPixelType OutputImageInternalPixelType
Definition: otbThresholdVectorImageFilter.h:72
otb::ThresholdVectorImageFilter::InputImageRegionType
InputImageType::RegionType InputImageRegionType
Definition: otbThresholdVectorImageFilter.h:63
otb::ThresholdVectorImageFilter::Self
ThresholdVectorImageFilter Self
Definition: otbThresholdVectorImageFilter.h:48
otb::ThresholdVectorImageFilter::GenerateOutputInformation
void GenerateOutputInformation(void) override
Definition: otbThresholdVectorImageFilter.h:118
otb::ThresholdVectorImageFilter::InputImageType
TInputImage InputImageType
Definition: otbThresholdVectorImageFilter.h:57
otb::ThresholdVectorImageFilter::InputImagePointer
InputImageType::ConstPointer InputImagePointer
Definition: otbThresholdVectorImageFilter.h:62
otb::ThresholdVectorImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbThresholdVectorImageFilter.h:51
otb::ThresholdVectorImageFilter::InputImagePixelType
InputImageType::PixelType InputImagePixelType
Definition: otbThresholdVectorImageFilter.h:64