Commit 5ae5a17d authored by Antoine Regimbeau's avatar Antoine Regimbeau

ENH: make GlobalStatsDetected public and allow returning empty expression

parent d79bbf76
......@@ -112,8 +112,8 @@ public:
/** Set an expression to be parsed */
void SetExpression(const std::string& expression);
/** Return the nth expression to be parsed */
std::string GetExpression(int) const;
/** Return the nth expression to be parsed*/
std::string GetExpression(unsigned int IDExpression) const;
/** Set a matrix (or a vector) */
void SetMatrix(const std::string& name, const std::string& definition);
......@@ -127,9 +127,15 @@ public:
/** Import constants and expressions from a given filename */
void ImportContext(const std::string& filename);
/** Clear all previously set expression*/
void ClearExpression();
/** Return the variable and constant names */
std::vector<std::string> GetVarNames() const;
bool GlobalStatsDetected() const
{
return !m_StatsVarDetected.empty();
}
protected :
BandMathXImageFilter();
......@@ -145,11 +151,6 @@ protected :
private :
bool globalStatsDetected() const
{
return (m_StatsVarDetected.size()>0);
}
typedef struct {
std::string name;
ValueType value;
......
......@@ -261,7 +261,13 @@ void BandMathXImageFilter<TImage>
this->Modified();
}
template< typename TImage >
void BandMathXImageFilter<TImage>
::ClearExpression()
{
m_Expression.clear();
this->Modified();
}
template< typename TImage >
void BandMathXImageFilter<TImage>
::SetMatrix(const std::string& name, const std::string& definition)
......@@ -517,9 +523,11 @@ void BandMathXImageFilter<TImage>
template< typename TImage >
std::string BandMathXImageFilter<TImage>
::GetExpression(int IDExpression) const
::GetExpression(unsigned int IDExpression) const
{
return m_Expression[IDExpression];
if ( IDExpression < m_Expression.size() )
return m_Expression[IDExpression];
return "";
}
......@@ -913,7 +921,7 @@ void BandMathXImageFilter< TImage >
CheckImageDimensions();
PrepareParsers();
if (globalStatsDetected())
if (GlobalStatsDetected())
PrepareParsersGlobStats();
OutputsDimensions();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment