/usr/include/OTB-6.4/otbMaskMuParserFunctor.h is in libotb-dev 6.4.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | /*
* Copyright (C) 1999-2011 Insight Software Consortium
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbMaskMuParserFunctor_h
#define otbMaskMuParserFunctor_h
#include "otbParser.h"
#include "otbMacro.h"
#include "otbBinarySpectralAngleFunctor.h"
namespace otb
{
/** \class MaskMuParserFunctor
* \brief Functor used to create binary mask for input of connected component segmentation module.
*
* This functor is based on the mathematical parser library muParser.
* The built in functions and operators list is available at:
* http://muparser.sourceforge.net/mup_features.html#idDef2
*
* OTB additional functions:
* ndvi(r, niri)
*
* OTB additional constants:
* e - log2e - log10e - ln2 - ln10 - pi - euler
*
* \sa Parser
*
*
* \ingroup OTBMathParser
*/
/** \class MaskMuParserFunctor
* \brief This functor use MuParser to evaluate and process mathematical expression
*
* \ingroup OTBMathParser
*/
namespace Functor
{
template<class TInputPixel>
class ITK_EXPORT MaskMuParserFunctor: public itk::LightObject
{
public:
typedef MaskMuParserFunctor Self;
typedef itk::LightObject Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(MaskMuParserFunctor, itk::LightObject);
typedef TInputPixel PixelType;
typedef Parser ParserType;
typedef BinarySpectralAngleFunctor<PixelType, PixelType, double> SpectralAngleFunctorType;
bool operator()(const PixelType &p);
const std::map<std::string, Parser::ValueType*>& GetVar() const;
Parser::FunctionMapType GetFunList() const;
void SetExpression(const std::string& expression);
/** Return the expression to be parsed */
std::string GetExpression() const;
void SetNumberOfBands(unsigned int NbOfBands);
/** Set the reference pixel used to compute the "spectralangle" parser variable */
void SetSpectralAngleReferencePixel(const PixelType& refPixel);
/** Check the expression */
bool CheckExpression();
protected:
MaskMuParserFunctor();
~MaskMuParserFunctor() ITK_OVERRIDE;
private:
MaskMuParserFunctor(const Self &); //purposely not implemented
void operator =(const Self &); //purposely not implemented
std::string m_Expression;
ParserType::Pointer m_Parser;
std::vector<double> m_AImage;
//std::vector<std::string > m_VarName;
unsigned int m_NbOfBands;
//unsigned int m_NbVar;
double m_ParserResult;
//user defined variables
double m_Intensity;
double m_SpectralAngle;
PixelType m_SpectralAngleReferencePixel;
SpectralAngleFunctorType m_SpectralAngleFunctor;
};
} // end of Functor namespace
}//end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbMaskMuParserFunctor.txx"
#endif
#endif
|