/usr/include/OTB-5.8/otbMaskMuParserFunctor.h is in libotb-dev 5.8.0+dfsg-3.
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 | /*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
Some parts of this code are derived from ITK. See ITKCopyright.txt
for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#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
|