Skip to content
Snippets Groups Projects
Commit d8813083 authored by Jonathan Guinet's avatar Jonathan Guinet
Browse files

ENH mu parser function list accessor in MaskMuParserFilter...

ENH mu parser function list accessor in MaskMuParserFilter ConnectedComponentMaskMuParserFunctor and LabelObjectMuParserFilter.
parent ed1a6f5d
No related branches found
No related tags found
No related merge requests found
......@@ -193,6 +193,11 @@ public:
return this->m_Parser->GetVar();
}
const mu::funmap_type &GetFunList() const
{
return this->m_Parser->GetFunList();
}
ConnectedComponentMuParserFunctor()
{
m_Parser = ParserType::New();
......
......@@ -110,9 +110,12 @@ void SetAttributes(std::vector<std::string> shapeAttributes, std::vector<std::st
/** Display varname and address **/
void DisplayVar() const;
/** return list of Mu Parser varialbes and address**/
/** return list of Mu Parser variables and address**/
const std::map<std::string, double*>& GetVar() const;
/** return list of Mu Parser functions**/
const mu::funmap_type& GetFunList() const;
virtual void AllocateOutputs();
void GenerateInputRequestedRegion();
......
......@@ -80,6 +80,13 @@ const std::map<std::string, double*>& LabelObjectOpeningMuParserFilter<TImage, T
return this->m_Functor.GetVar();
}
template< class TImage, class TFunction>
const mu::funmap_type& LabelObjectOpeningMuParserFilter<TImage, TFunction>::GetFunList() const
{
return this->m_Functor.GetFunList();
}
template< class TImage, class TFunction>
void LabelObjectOpeningMuParserFilter<TImage, TFunction>::DisplayVar() const
{
......
......@@ -115,6 +115,8 @@ public:
const std::map<std::string, double*>&GetVar();
const mu::funmap_type &GetFunList();
protected:
MaskMuParserFilter();
virtual ~MaskMuParserFilter();
......
......@@ -91,6 +91,29 @@ const std::map<std::string, double*>& MaskMuParserFilter<TInputImage, TOutputIma
return functor.GetVar();
}
template<class TInputImage, class TOutputImage, class TFunction>
const mu::funmap_type& MaskMuParserFilter<TInputImage, TOutputImage, TFunction>::GetFunList()
{
FunctorPointer tempFunctor = FunctorType::New();
tempFunctor->SetExpression(m_Expression);
FunctorType& functor = *tempFunctor;
try
{
functor(this->GetInput()->GetPixel(this->GetInput()->GetBufferedRegion().GetIndex()));
}
catch (itk::ExceptionObject& err)
{
itkDebugMacro(<< err);
}
return functor.GetFunList();
}
template<class TInputImage, class TOutputImage, class TFunction>
bool MaskMuParserFilter<TInputImage, TOutputImage, TFunction>::CheckExpression()
{
......
......@@ -31,6 +31,8 @@
#include "otbBinarySpectralAngleFunctor.h"
#include "muParserCallback.h"
namespace otb
{
/** \class MaskMuParserFunctor
......@@ -80,6 +82,9 @@ public:
const std::map<std::string, Parser::ValueType*>& GetVar() const;
const mu::funmap_type& GetFunList() const;
void SetExpression(const std::string& expression);
/** Return the expression to be parsed */
......
......@@ -80,6 +80,14 @@ MaskMuParserFunctor<TInputPixel>::GetVar() const
return this->m_Parser->GetVar();
}
template<class TInputPixel>
const mu::funmap_type&
MaskMuParserFunctor<TInputPixel>::GetFunList() const
{
return this->m_Parser->GetFunList();
}
template<class TInputPixel>
void
MaskMuParserFunctor<TInputPixel>::SetExpression(const std::string& expression)
......
......@@ -192,6 +192,10 @@ public:
return this->m_Parser->GetVar();
}
const mu::funmap_type& GetFunList() const
{
return this->m_Parser->GetFunList();
}
OBIAMuParserFunctor()
{
......
......@@ -159,5 +159,11 @@ const std::map<std::string, Parser::ValueType*>& Parser::GetVar() const
return m_InternalParser.GetVar();
}
// Get the map with the functions
const mu::funmap_type& Parser::GetFunList() const
{
return m_InternalParser.GetFunDef();
}
}//end namespace otb
......@@ -78,6 +78,9 @@ public:
/** Return the list of variables */
const std::map<std::string, ValueType*>& GetVar() const;
/** Return the list of variables */
const mu::funmap_type& GetFunList() const;
/** Check Expression **/
bool CheckExpr();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment