diff --git a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.h b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.h
index 9822cd6ab731a520109484ec9e4bd32947f65468..ce76dd8e44ded0f672a328bb72bcabdf6566dced 100644
--- a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.h
+++ b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.h
@@ -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;
diff --git a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.hxx b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.hxx
index 6092926c7d22d861d0a88a811de26f9f537d016c..44cde5bed777f89ebfada6a1e1c24de73a2802d1 100644
--- a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.hxx
+++ b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.hxx
@@ -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();