OTB  9.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-2022 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:
129  LabelObjectOpeningMuParserFilter(const Self&) = delete;
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
otb::LabelObjectOpeningMuParserFilter::Self
LabelObjectOpeningMuParserFilter Self
Definition: otbLabelObjectOpeningMuParserFilter.h:66
otb::LabelObjectOpeningMuParserFilter::LabelObjectConstPointer
LabelObjectType::ConstPointer LabelObjectConstPointer
Definition: otbLabelObjectOpeningMuParserFilter.h:79
otb::LabelObjectOpeningMuParserFilter::ImageConstPointer
ImageType::ConstPointer ImageConstPointer
Definition: otbLabelObjectOpeningMuParserFilter.h:74
otbOBIAMuParserFunctor.h
otbLabelObjectOpeningMuParserFilter.hxx
otb::Parser::FunctionMapType
std::map< std::string, int > FunctionMapType
Definition: otbParser.h:64
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::LabelObjectOpeningMuParserFilter::AttributeType
LabelObjectType::AttributeType AttributeType
Definition: otbLabelObjectOpeningMuParserFilter.h:81
otb::LabelObjectOpeningMuParserFilter::IndexType
ImageType::IndexType IndexType
Definition: otbLabelObjectOpeningMuParserFilter.h:76
otb::LabelObjectOpeningMuParserFilter::m_Expression
std::string m_Expression
Definition: otbLabelObjectOpeningMuParserFilter.h:133
otb::LabelObjectOpeningMuParserFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbLabelObjectOpeningMuParserFilter.h:68
otb::LabelObjectOpeningMuParserFilter::ImageType
TImage ImageType
Definition: otbLabelObjectOpeningMuParserFilter.h:72
otb::LabelObjectOpeningMuParserFilter::m_Functor
FunctorType m_Functor
Definition: otbLabelObjectOpeningMuParserFilter.h:132
otb::LabelObjectOpeningMuParserFilter
Definition: otbLabelObjectOpeningMuParserFilter.h:62
otb::LabelObjectOpeningMuParserFilter::Superclass
itk::InPlaceLabelMapFilter< TImage > Superclass
Definition: otbLabelObjectOpeningMuParserFilter.h:67
otb::LabelObjectOpeningMuParserFilter::EnlargeOutputRequestedRegion
void EnlargeOutputRequestedRegion(itk::DataObject *) override
Definition: otbLabelObjectOpeningMuParserFilter.h:117
otb::LabelObjectOpeningMuParserFilter::ImagePointer
ImageType::Pointer ImagePointer
Definition: otbLabelObjectOpeningMuParserFilter.h:73
otb::LabelObjectOpeningMuParserFilter::FunctorType
TFunction FunctorType
Definition: otbLabelObjectOpeningMuParserFilter.h:80
otb::LabelObjectOpeningMuParserFilter::InputImageRegionType
ImageType::RegionType InputImageRegionType
Definition: otbLabelObjectOpeningMuParserFilter.h:77
otb::LabelObjectOpeningMuParserFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbLabelObjectOpeningMuParserFilter.h:69
otb::LabelObjectOpeningMuParserFilter::LabelObjectType
ImageType::LabelObjectType LabelObjectType
Definition: otbLabelObjectOpeningMuParserFilter.h:78
otb::LabelObjectOpeningMuParserFilter::PixelType
ImageType::PixelType PixelType
Definition: otbLabelObjectOpeningMuParserFilter.h:75