OTB  6.7.0
Orfeo Toolbox
otbBandMathImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2011 Insight Software Consortium
3  * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
4  *
5  * This file is part of Orfeo Toolbox
6  *
7  * https://www.orfeo-toolbox.org/
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 
23 #ifndef otbBandMathImageFilter_h
24 #define otbBandMathImageFilter_h
25 
26 #include "itkInPlaceImageFilter.h"
28 #include "itkArray.h"
29 
30 #include "otbParser.h"
31 #include <string>
32 
33 namespace otb
34 {
82 template< class TImage >
83 class ITK_EXPORT BandMathImageFilter
84  : public itk::InPlaceImageFilter< TImage >
85 {
86 public:
92 
94  itkNewMacro(Self);
95 
97  itkTypeMacro(BandMathImageFilter, InPlaceImageFilter);
98 
100  typedef TImage ImageType;
101  typedef typename ImageType::ConstPointer ImagePointer;
102  typedef typename ImageType::RegionType ImageRegionType;
103  typedef typename ImageType::PixelType PixelType;
104  typedef typename ImageType::IndexType IndexType;
109 
111  using Superclass::SetNthInput;
112  void SetNthInput( DataObjectPointerArraySizeType idx, const ImageType * image);
113  void SetNthInput( DataObjectPointerArraySizeType idx, const ImageType * image, const std::string& varName);
115 
117  void SetNthInputName(DataObjectPointerArraySizeType idx, const std::string& expression);
118 
120  void SetExpression(const std::string& expression);
121 
123  std::string GetExpression() const;
124 
126  std::string GetNthInputName(DataObjectPointerArraySizeType idx) const;
127 
129  ImageType * GetNthInput(DataObjectPointerArraySizeType idx);
130 
131 protected :
133  ~BandMathImageFilter() override;
134  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
135 
136  void BeforeThreadedGenerateData() override;
137  void ThreadedGenerateData(const ImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ) override;
138  void AfterThreadedGenerateData() override;
139 
140 private :
141  BandMathImageFilter(const Self&) = delete;
142  void operator=(const Self&) = delete;
143 
144  std::string m_Expression;
145  std::vector<ParserType::Pointer> m_VParser;
146  std::vector< std::vector<double> > m_AImage;
147  std::vector< std::string > m_VVarName;
148  unsigned int m_NbVar;
149 
152 
157 };
158 
159 }//end namespace otb
160 
161 #ifndef OTB_MANUAL_INSTANTIATION
163 #endif
164 
165 #endif
itk::SmartPointer< const Self > ConstPointer
Superclass::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Definition of the standard floating point parser. Standard implementation of the mathematical express...
Definition: otbParser.h:44
ImageType::IndexType IndexType
ImageType::SpacingType SpacingType
ImageType::PointType OrigineType
Performs a mathematical operation on the input images according to the formula specified by the user...
BandMathImageFilter< TImage > Self
itk::SmartPointer< Self > Pointer
itk::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:133
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
itk::Array< long > m_ThreadOverflow
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
itk::Array< long > m_ThreadUnderflow
unsigned int ThreadIdType
ImageType::PixelType PixelType
ImageType::RegionType ImageRegionType
std::vector< std::string > m_VVarName
ImageType::ConstPointer ImagePointer
std::vector< ParserType::Pointer > m_VParser
VectorImageType::SpacingType SpacingType
Definition: mvdTypes.h:181
itk::InPlaceImageFilter< TImage > Superclass
VectorImageType::PointType PointType
Definition: mvdTypes.h:189
std::vector< std::vector< double > > m_AImage