OTB  10.0.0
Orfeo Toolbox
otbLabelObjectOpeningMuParserFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2011 Insight Software Consortium
3  * Copyright (C) 2005-2024 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 otbLabelObjectOpeningMuParserFilter_h
24 #define otbLabelObjectOpeningMuParserFilter_h
25 
26 #include "itkProgressReporter.h"
27 #include <string>
28 #include <vector>
29 
30 #include "itkArray.h"
31 
32 
33 #include "itkInPlaceLabelMapFilter.h"
34 #include "itkLabelObjectAccessors.h"
35 #include "itkProgressReporter.h"
36 #include "otbOBIAMuParserFunctor.h"
37 
38 namespace otb
39 {
40 
61 template <class TImage, class TFunction = Functor::OBIAMuParserFunctor<typename TImage::LabelObjectType>>
62 class ITK_EXPORT LabelObjectOpeningMuParserFilter : public itk::InPlaceLabelMapFilter<TImage>
63 {
64 public:
67  typedef itk::InPlaceLabelMapFilter<TImage> Superclass;
68  typedef itk::SmartPointer<Self> Pointer;
69  typedef itk::SmartPointer<const Self> ConstPointer;
70 
72  typedef TImage ImageType;
73  typedef typename ImageType::Pointer ImagePointer;
74  typedef typename ImageType::ConstPointer ImageConstPointer;
75  typedef typename ImageType::PixelType PixelType;
76  typedef typename ImageType::IndexType IndexType;
77  typedef typename ImageType::RegionType InputImageRegionType;
78  typedef typename ImageType::LabelObjectType LabelObjectType;
79  typedef typename LabelObjectType::ConstPointer LabelObjectConstPointer;
80  typedef TFunction FunctorType;
81  typedef typename LabelObjectType::AttributeType AttributeType;
82 
84  itkStaticConstMacro(ImageDimension, unsigned int, TImage::ImageDimension);
85 
87  itkNewMacro(Self);
88 
90  itkTypeMacro(LabelObjectOpeningMuParserFilter, InPlaceLabelMapFilter);
91 
93  void SetExpression(const std::string expression);
94 
96  std::string GetExpression() const;
97 
99  bool CheckExpression();
100 
102  void SetAttributes(std::vector<std::string> shapeAttributes, std::vector<std::string> statAttributes, int nbOfBands);
103 
105  void DisplayVar() const;
106 
108  const std::map<std::string, double*>& GetVar() const;
109 
111  Parser::FunctionMapType GetFunList() const;
112 
113  void AllocateOutputs() override;
114 
115  void GenerateInputRequestedRegion() override;
116 
117  void EnlargeOutputRequestedRegion(itk::DataObject*) override
118  {
119  }
120 
121  void GenerateData() override;
122 
123 protected:
126  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
127 
128 private:
130  void operator=(const Self&) = delete;
131 
133  std::string m_Expression;
134 };
135 
136 } // end namespace otb
137 
138 #ifndef OTB_MANUAL_INSTANTIATION
140 #endif
141 
142 #endif
void EnlargeOutputRequestedRegion(itk::DataObject *) override
void operator=(const Self &)=delete
LabelObjectOpeningMuParserFilter(const Self &)=delete
std::map< std::string, int > FunctionMapType
Definition: otbParser.h:65
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.