diff --git a/Modules/Applications/AppSegmentation/app/otbSmallRegionsMerging.cxx b/Modules/Applications/AppSegmentation/app/otbSmallRegionsMerging.cxx
index 9f4d81647bf045baa3e06c3996477b989409710f..4112c9da433f7c10337368dbd75a6fa64800a97d 100644
--- a/Modules/Applications/AppSegmentation/app/otbSmallRegionsMerging.cxx
+++ b/Modules/Applications/AppSegmentation/app/otbSmallRegionsMerging.cxx
@@ -143,7 +143,7 @@ private:
       
     // Compute the LUT from the original label image to the merged output label image.
     auto regionMergingFilter = LabelImageSmallRegionMergingFilterType::New();
-    regionMergingFilter->SetInput( labelIn );
+    regionMergingFilter->SetInputLabelImage( labelIn );
     regionMergingFilter->SetLabelPopulation( labelPopulation );
     regionMergingFilter->SetLabelStatistic( meanValues );
     
diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.h b/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.h
index 710e577a1738686960951a6484a3278f0a954f36..66efb3c2cc351e44ae1f88ba179b0788cd55727e 100644
--- a/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.h
+++ b/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.h
@@ -25,6 +25,7 @@
 #include "otbPersistentFilterStreamingDecorator.h"
 
 #include <unordered_map>
+#include <unordered_set>
 
 namespace otb
 {
@@ -177,12 +178,12 @@ private:
  */
 template <class TInputLabelImage>
 class ITK_EXPORT LabelImageSmallRegionMergingFilter 
-  : public itk::ImageToImageFilter<TInputLabelImage, TInputLabelImage>
+  : public itk::ProcessObject
 {
 public:
   /** Standard Self typedef */
   typedef LabelImageSmallRegionMergingFilter                         Self;
-  typedef itk::ImageToImageFilter<TInputLabelImage, TInputLabelImage>      Superclass;
+  typedef itk::ProcessObject      Superclass;
   typedef itk::SmartPointer<Self>                                     Pointer;
   typedef itk::SmartPointer<const Self>                               ConstPointer;
 
@@ -190,7 +191,7 @@ public:
   itkNewMacro(Self);
 
   /** Creation through object factory macro */
-  itkTypeMacro(LabelImageSmallRegionMergingFilter, itk::ImageToImageFilter);
+  itkTypeMacro(LabelImageSmallRegionMergingFilter, itk::ProcessObject);
 
   // Small region merging filter typedefs
   typedef PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage > PersistentLabelImageSmallRegionMergingFilterType;
@@ -205,6 +206,12 @@ public:
   itkGetMacro(MinSize , unsigned int);
   itkSetMacro(MinSize , unsigned int);
 
+  /** Set the Label population map */
+  void SetInputLabelImage( const TInputLabelImage * labelImage )
+  {
+    m_SmallRegionMergingFilter->GetFilter()->SetInput( labelImage );
+  }
+  
   /** Set the Label population map */
   void SetLabelPopulation( LabelPopulationType const & labelPopulation )
   {
@@ -235,6 +242,8 @@ public:
     return m_SmallRegionMergingFilter->GetFilter()->GetLUT();
   }
   
+  void Update(void) override;
+
 protected:
   /** Constructor */
   LabelImageSmallRegionMergingFilter();
diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.hxx b/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.hxx
index 50a8e180bf0ef26e73cfa0fb75d65f052195ad9d..6cabcbaf2ccca334ebd98e19fdb3896fccf27a51 100644
--- a/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.hxx
+++ b/Modules/Segmentation/Conversion/include/otbLabelImageSmallRegionMergingFilter.hxx
@@ -23,11 +23,9 @@
 #define otbLabelImageSmallRegionMergingFilter_hxx
 
 #include "otbLabelImageSmallRegionMergingFilter.h"
-#include "itkImageConstIterator.h"
 #include "itkConstShapedNeighborhoodIterator.h"
 #include "itkProgressReporter.h"
 
-#include <time.h>
 namespace otb
 {
 template <class TInputLabelImage >
@@ -64,7 +62,7 @@ PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage >
   // to the euclidian distance between the corresponding m_labelStatistic elements.
   for (auto const & neighbours : neighboursMap)
     {
-    double proximity = std::numeric_limits<double>::max();
+    double proximity = itk::NumericTraits<double>::max();
     InputLabelType label = neighbours.first;
     InputLabelType closestNeighbour = label;
     for (auto const & neighbour : neighbours.second)
@@ -72,11 +70,8 @@ PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage >
       auto statsLabel = m_LabelStatistic[ label ];
       auto statsNeighbour = m_LabelStatistic[ neighbour ];
       assert( statsLabel.Size() == statsNeighbour.Size() );
-      double distance = 0;
-      for (unsigned int i = 0 ; i < statsLabel.Size(); i++)
-        {
-        distance += (statsLabel[i] - statsNeighbour[i]) * (statsLabel[i] - statsNeighbour[i]);
-        }
+      
+      double distance = (statsLabel - statsNeighbour).GetSquaredNorm();
       if (distance < proximity)
         {
         proximity = distance;
@@ -203,7 +198,6 @@ PersistentLabelImageSmallRegionMergingFilter< TInputLabelImage >
     assert( !itN.IsAtEnd() );
     int currentLabel = m_LUT[ it.Get() ];
     
-    
     if ( m_LabelPopulation[currentLabel] == m_Size )
       {
       for (auto ci = itN.Begin() ; !ci.IsAtEnd(); ci++)
@@ -231,14 +225,20 @@ LabelImageSmallRegionMergingFilter< TInputLabelImage >
   m_SmallRegionMergingFilter = LabelImageSmallRegionMergingFilterType::New();
 }
 
+template <class TInputLabelImage>
+void
+LabelImageSmallRegionMergingFilter<TInputLabelImage>
+::Update(void)
+{
+  this->GenerateData();
+}
+
 template <class TInputLabelImage >
 void
 LabelImageSmallRegionMergingFilter< TInputLabelImage >
 ::GenerateData()
 {
   this->SetProgress(0.0);
-  auto labelImage = this->GetInput();
-  m_SmallRegionMergingFilter->GetFilter()->SetInput( labelImage );
 
   // Update the filter for all sizes.
   for (unsigned int size = 1; size < m_MinSize; size++)