OTB  9.0.0
Orfeo Toolbox
otbClampVectorImageFilter.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 otbClampVectorImageFilter_h
22 #define otbClampVectorImageFilter_h
23 
24 #include "itkImageToImageFilter.h"
25 
26 namespace otb
27 {
28 
47 template <class TInputImage, class TOutputImage = TInputImage>
48 class ITK_EXPORT ClampVectorImageFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
49 {
50 public:
53  typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
54  typedef itk::SmartPointer<Self> Pointer;
55  typedef itk::SmartPointer<const Self> ConstPointer;
56 
58  itkNewMacro(Self);
59 
61  itkTypeMacro(ClampVectorImageFilter, itk::ImageToImageFilter);
62 
63 
65  typedef TInputImage InputImageType;
66  typedef typename InputImageType::ConstPointer InputImagePointer;
67  typedef typename InputImageType::RegionType InputImageRegionType;
68  typedef typename InputImageType::PixelType InputImagePixelType;
69  typedef typename InputImageType::InternalPixelType InputImageInternalPixelType;
70 
72  typedef TOutputImage OutputImageType;
73  typedef typename OutputImageType::Pointer OutputImagePointer;
74  typedef typename OutputImageType::RegionType OutputImageRegionType;
75  typedef typename OutputImageType::PixelType OutputImagePixelType;
76  typedef typename OutputImageType::InternalPixelType OutputImageInternalPixelType;
77 
78 
80  void ClampAbove(const OutputImageInternalPixelType& thresh);
81 
83  void ClampBelow(const OutputImageInternalPixelType& thresh);
84 
86  void ClampOutside(const OutputImageInternalPixelType& lower, const OutputImageInternalPixelType& upper);
87 
90  {
91  m_Lower = val;
92  m_DLower = static_cast<double>(val);
93  this->Modified();
94  }
95  itkGetConstMacro(Lower, OutputImageInternalPixelType);
97 
100  {
101  m_Upper = val;
102  m_DUpper = static_cast<double>(val);
103  this->Modified();
104  }
105  itkGetConstMacro(Upper, OutputImageInternalPixelType);
107 
108 
109 protected:
112  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
113 
124  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
125 
126  void GenerateOutputInformation(void) override
127  {
128  Superclass::GenerateOutputInformation();
129 
130  this->GetOutput()->SetNumberOfComponentsPerPixel(this->GetInput()->GetNumberOfComponentsPerPixel());
131  }
132 
133 private:
134  ClampVectorImageFilter(const Self&) = delete;
135  void operator=(const Self&) = delete;
136 
137  double m_DLower;
138  double m_DUpper;
139 
142 };
143 
144 
145 } // end namespace otb
146 
147 #ifndef OTB_MANUAL_INSTANTIATION
149 #endif
150 
151 #endif
otb::ClampVectorImageFilter::m_DUpper
double m_DUpper
Definition: otbClampVectorImageFilter.h:138
otb::ClampVectorImageFilter::InputImageRegionType
InputImageType::RegionType InputImageRegionType
Definition: otbClampVectorImageFilter.h:67
otb::ClampVectorImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbClampVectorImageFilter.h:55
otb::ClampVectorImageFilter
Set image values to a user-specified value if they are below, above, or between simple threshold valu...
Definition: otbClampVectorImageFilter.h:48
otb::ClampVectorImageFilter::InputImageInternalPixelType
InputImageType::InternalPixelType InputImageInternalPixelType
Definition: otbClampVectorImageFilter.h:69
otb::ClampVectorImageFilter::OutputImagePixelType
OutputImageType::PixelType OutputImagePixelType
Definition: otbClampVectorImageFilter.h:75
otb::ClampVectorImageFilter::OutputImageRegionType
OutputImageType::RegionType OutputImageRegionType
Definition: otbClampVectorImageFilter.h:74
otb::ClampVectorImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbClampVectorImageFilter.h:54
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ClampVectorImageFilter::SetUpper
void SetUpper(OutputImageInternalPixelType val)
Definition: otbClampVectorImageFilter.h:99
otb::ClampVectorImageFilter::SetLower
void SetLower(OutputImageInternalPixelType val)
Definition: otbClampVectorImageFilter.h:89
otb::ClampVectorImageFilter::Superclass
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
Definition: otbClampVectorImageFilter.h:53
otb::ClampVectorImageFilter::InputImageType
TInputImage InputImageType
Definition: otbClampVectorImageFilter.h:61
otb::ClampVectorImageFilter::InputImagePointer
InputImageType::ConstPointer InputImagePointer
Definition: otbClampVectorImageFilter.h:66
otb::ClampVectorImageFilter::m_Lower
OutputImageInternalPixelType m_Lower
Definition: otbClampVectorImageFilter.h:140
otb::ClampVectorImageFilter::OutputImageInternalPixelType
OutputImageType::InternalPixelType OutputImageInternalPixelType
Definition: otbClampVectorImageFilter.h:76
otb::ClampVectorImageFilter::Self
ClampVectorImageFilter Self
Definition: otbClampVectorImageFilter.h:52
otb::ClampVectorImageFilter::OutputImagePointer
OutputImageType::Pointer OutputImagePointer
Definition: otbClampVectorImageFilter.h:73
otb::ClampVectorImageFilter::m_Upper
OutputImageInternalPixelType m_Upper
Definition: otbClampVectorImageFilter.h:141
otb::ClampVectorImageFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbClampVectorImageFilter.h:72
otb::ClampVectorImageFilter::InputImagePixelType
InputImageType::PixelType InputImagePixelType
Definition: otbClampVectorImageFilter.h:68
otb::ClampVectorImageFilter::~ClampVectorImageFilter
~ClampVectorImageFilter() override
Definition: otbClampVectorImageFilter.h:111
otbClampVectorImageFilter.hxx
otb::ClampVectorImageFilter::m_DLower
double m_DLower
Definition: otbClampVectorImageFilter.h:137
otb::ClampVectorImageFilter::GenerateOutputInformation
void GenerateOutputInformation(void) override
Definition: otbClampVectorImageFilter.h:126