diff --git a/Code/Common/otbPolyLineParametricPathWithValue.h b/Code/Common/otbPolyLineParametricPathWithValue.h
index 379c4a924b78e9a7fd47a8970c7ddd8c19f07d32..ffabc0caafd0df7f3d66e4a0a9ebbb36d0b175e7 100644
--- a/Code/Common/otbPolyLineParametricPathWithValue.h
+++ b/Code/Common/otbPolyLineParametricPathWithValue.h
@@ -86,6 +86,8 @@ public:
    */
   virtual double GetLength() const;
 
+  void  AddVertex (const ContinuousIndexType &vertex);
+  
 protected:
   /** Constructor */
   PolyLineParametricPathWithValue();
@@ -95,10 +97,14 @@ protected:
   /**PrintSelf method */
   virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
 
+  virtual void ComputeLength() const;
+  
 private:
   PolyLineParametricPathWithValue(const Self&); //purposely not implemented
   void operator=(const Self&); //purposely not implemented
   std::string m_Key;
+  mutable double m_Length;
+  mutable bool m_LengthIsValid;
 };
 }// End namespace otb
 
diff --git a/Code/Common/otbPolyLineParametricPathWithValue.txx b/Code/Common/otbPolyLineParametricPathWithValue.txx
index 4835b86344e0aa0010f365446c32bb2e5ca5cee6..5031fb4a3126815880e981c4b0c6cd73b7a0929f 100644
--- a/Code/Common/otbPolyLineParametricPathWithValue.txx
+++ b/Code/Common/otbPolyLineParametricPathWithValue.txx
@@ -32,11 +32,33 @@ PolyLineParametricPathWithValue<TValue,VDimension>
   itk::MetaDataDictionary & dict = this->GetMetaDataDictionary();
   m_Key = "Value";
   itk::EncapsulateMetaData<ValueType>(dict,m_Key,0);
+  m_LengthIsValid = false;
+  m_Length = -1.0;
+}
+
+template < class TValue,unsigned int VDimension>
+void PolyLineParametricPathWithValue<TValue,VDimension>
+::AddVertex(const ContinuousIndexType &vertex)
+{
+  Superclass::AddVertex(vertex);
+  m_LengthIsValid=false;
 }
 
 template < class TValue,unsigned int VDimension>
 double PolyLineParametricPathWithValue<TValue,VDimension>
 ::GetLength() const
+{
+  if (!m_LengthIsValid)
+  {
+    ComputeLength();
+  }
+  return m_Length;
+}
+
+template < class TValue,unsigned int VDimension>
+void 
+PolyLineParametricPathWithValue<TValue,VDimension>
+::ComputeLength() const
 {
   double length = 0.0;
   VertexListConstIteratorType it =  this->GetVertexList()->Begin();
@@ -68,7 +90,8 @@ double PolyLineParametricPathWithValue<TValue,VDimension>
     length = 0.0;
   }
 
-  return length;
+  m_Length = length;
+  m_LengthIsValid = true;
 }