diff --git a/Code/BasicFilters/otbMeanShiftImageFilter2.h b/Code/BasicFilters/otbMeanShiftImageFilter2.h
index 467652249aa521e48d27bf585e776af571794a19..cfd8033c12876b9a434685e57807c2d4f58f94fb 100644
--- a/Code/BasicFilters/otbMeanShiftImageFilter2.h
+++ b/Code/BasicFilters/otbMeanShiftImageFilter2.h
@@ -64,7 +64,47 @@ namespace otb
  * \ingroup ImageEnhancement
  */
 
-template <class TInputImage, class TOutputMetricImage,class TOutputImage,class TKernel>
+class KernelUniform
+{
+public:
+  typedef double RealType;
+
+  KernelUniform() {
+    SetBandwidth(1.0);
+  }
+
+  ~KernelUniform() {}
+  inline RealType operator() (RealType x) {
+    return (x >= -m_Bandwidth || x <= m_Bandwidth) ? m_KernelUniformValue : 0.0;
+  }
+
+  RealType GetRadius() {
+    return m_Radius;
+  }
+
+  RealType GetBandwidth() {
+    return m_Bandwidth;
+  }
+
+  void SetBandwidth(RealType bw) {
+    m_Bandwidth = bw;
+    m_KernelUniformValue = 1.0 / (2.0 * m_Bandwidth);
+    m_Radius = m_Bandwidth;
+  }
+
+private:
+  RealType m_Radius;
+  RealType m_Bandwidth;
+  RealType m_KernelUniformValue;
+};
+
+class NormL2
+{
+};
+
+
+
+template <class TInputImage, class TOutputImage, class TKernel = KernelUniform, class TNorm = NormL2, class TOutputMetricImage = TOutputImage, class TOutputIterationImage = otb::Image<unsigned int, TInputImage::ImageDimension> >
 class ITK_EXPORT MeanShiftImageFilter2
   : public itk::ImageToImageFilter<TInputImage, TOutputImage>
 {
@@ -80,6 +120,7 @@ public:
   itkNewMacro(Self);
 
   /** Template parameters typedefs */
+  typedef double                                RealType;
   typedef TInputImage                           InputImageType;
   typedef typename InputImageType::Pointer      InputImagePointerType;
   typedef typename InputImageType::PixelType    InputPixelType;
@@ -99,28 +140,20 @@ public:
   typedef typename OutputMetricImageType::Pointer     OutputMetricImagePointerType;
   typedef typename OutputMetricImageType::PixelType   OutputMetricPixelType;
   typedef typename OutputMetricImageType::RegionType  MetricRegionType;
-  
-  typedef unsigned int                                OutputIterationPixelType;
-  typedef otb::Image<OutputIterationPixelType, 2>                OutputIterationImageType;
 
-  typedef TKernel      KernelType;
+  typedef TOutputIterationImage                 OutputIterationImageType;
 
-  /** Setters / Getters */
-  itkSetMacro(SpatialRadius, InputSizeType);
-  itkGetMacro(SpatialRadius, InputSizeType);
-  itkSetMacro(RangeRadius, InputSizeType);
-  itkGetMacro(RangeRadius,InputSizeType);
+  typedef TKernel                               KernelType;
 
-  itkGetConstMacro(SpectralBandwidth, double);
-  itkSetMacro(SpectralBandwidth, double);
-  itkGetConstMacro(SpatialBandwidth, double);
-  itkSetMacro(SpatialBandwidth, double);
+  /** Setters / Getters */
+  itkSetMacro(SpatialBandwidth, RealType);
+  itkGetMacro(SpatialBandwidth, RealType);
+  itkSetMacro(RangeBandwidth, RealType);
+  itkGetMacro(RangeBandwidth, RealType);
 
   itkGetConstMacro(MaxIterationNumber, unsigned int);
   itkSetMacro(MaxIterationNumber, unsigned int);
 
-  itkGetConstMacro(IterationCount, unsigned int);
-
   itkGetConstMacro(Threshold, double);
   itkSetMacro(Threshold, double);
 
@@ -134,19 +167,18 @@ public:
   const OutputImageType * GetRangeOutput() const;
   /** Return the spectral image output */
   const OutputMetricImageType * GetMetricOutput() const;
+  /** Returns the number of iterations done at each pixel */
+  const OutputIterationImageType * GetIterationOutput() const;
+
   /** Return the const spatial image output */
   OutputImageType * GetSpatialOutput();
    /** Return the spectral image output */
   OutputImageType * GetRangeOutput();
   /** Return the mean shift vector image output */
   OutputMetricImageType * GetMetricOutput();
-
   /** Returns the number of iterations done at each pixel */
   OutputIterationImageType * GetIterationOutput();
 
-  bool IsImageLatticeInitialized()
-    {return m_ImageLatticeInitialized; };
-
 protected:
 
 
@@ -189,13 +221,12 @@ protected:
   /**PrintSelf method */
   virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
 
-
  //virtual void GetNeighborhood(PointType latticePosition);
  virtual void GetNeighborhood(OutputPixelType **neighborhood,PointType latticePosition);
 
  virtual OutputMetricPixelType CalculateMeanShiftVector(OutputPixelType *neighbothood,OutputPixelType spatialPixel,OutputPixelType rangePixel);
 
- virtual void CreateUniformKernel();
+ // virtual void CreateUniformKernel();
 private:
   MeanShiftImageFilter2(const Self &); //purposely not implemented
   void operator =(const Self&);             //purposely not implemented
@@ -204,34 +235,27 @@ private:
   void Initialize();
 
   /** returns the largest radius **/
-  InputSizeType GetLargestRadius()
-  {
-    InputSizeType largestRadius;
-    largestRadius[0]=std::max(m_SpatialRadius[0],m_RangeRadius[0]);
-    largestRadius[1]=std::max(m_SpatialRadius[1],m_RangeRadius[1]);
-    return largestRadius;
-  };
+  // InputSizeType GetLargestRadius()
+  // {
+  //   InputSizeType largestRadius;
+  //   largestRadius[0]=std::max(m_SpatialRadius[0],m_RangeRadius[0]);
+  //   largestRadius[1]=std::max(m_SpatialRadius[1],m_RangeRadius[1]);
+  //   return largestRadius;
+  // };
 
 
-  /** Spatial radius for mean shift convergence */
-  InputSizeType m_SpatialRadius;
-  /** Range radius for mean shift convergence */
-  InputSizeType m_RangeRadius;
 
-  double        m_SpectralBandwidth;
-  double        m_SpatialBandwidth;
+  /** Range bandwidth */
+  RealType        m_RangeBandwidth;
 
-  /** **/
-  double m_Threshold;
+  /** Spatial bandwidth */
+  RealType      m_SpatialBandwidth;
 
-  /** is the lattice initialized **/
-  bool m_ImageLatticeInitialized;
+  /** Radius of pixel neighborhood, determined by the kernel from the spatial bandwidth  */
+  InputSizeType      m_SpatialRadius;
 
-  /** is the lattice initialized **/
-  bool m_HasConverged;
-
-  /** mean shift iteration count **/
-  unsigned int m_IterationCount;
+  /** **/
+  double m_Threshold;
 
   /** max iteration number **/
   unsigned int m_MaxIterationNumber;
@@ -240,18 +264,21 @@ private:
   //OutputPixelType *m_Neighborhood;
 
   /** Kernel pointer **/
-  OutputPixelType *m_SpatialKernel;
-  OutputPixelType *m_RangeKernel;
-  OutputPixelType *m_Kernel;
+  // OutputPixelType *m_SpatialKernel;
+  // OutputPixelType *m_RangeKernel;
+  // OutputPixelType *m_Kernel;
 
   /** KernelType to be defined **/
-  //KernelType m_Kernel;
+  KernelType m_SpatialKernel;
+  KernelType m_RangeKernel;
+
 
   bool m_NeighborhoodHasTobeUpdated;
 
   unsigned int m_NumberOfSpatialComponents;
 
 };
+
 } // end namespace otb
 
 #ifndef OTB_MANUAL_INSTANTIATION
diff --git a/Code/BasicFilters/otbMeanShiftImageFilter2.txx b/Code/BasicFilters/otbMeanShiftImageFilter2.txx
index ba7bc6155ba8959215caa2896d5ed8f2cb72e55e..5fa2e7fcfa6be301b3b3bdd47f1c2882e251f24d 100644
--- a/Code/BasicFilters/otbMeanShiftImageFilter2.txx
+++ b/Code/BasicFilters/otbMeanShiftImageFilter2.txx
@@ -37,29 +37,20 @@
 
 namespace otb
 {
-template <class TInputImage, class TOutputMetricImage,class TOutputImage,class TKernel>
-MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::MeanShiftImageFilter2()
 {
-  m_SpatialRadius.Fill(3);
-  m_RangeRadius.Fill(9);
-  m_ImageLatticeInitialized = false;
-  m_HasConverged = false;
-  m_IterationCount = 0;
+
+
   m_MaxIterationNumber = 4;
-  //this->SetRadius();
-  m_SpatialKernel=NULL;
-  m_RangeKernel=NULL;
-  m_Kernel=NULL;
 
-  m_SpectralBandwidth=16.;
-  m_SpatialBandwidth=8.;
+  m_SpatialBandwidth = 3;
+  m_RangeBandwidth=16.;
 
   m_Threshold=1e-3;
-  m_NumberOfSpatialComponents=2; //image lattice
-  //CreateKernel by default
- // m_Kernel.CreateStructuringElement();
 
+  m_NumberOfSpatialComponents=TInputImage::ImageDimension; //image lattice
 
   m_NeighborhoodHasTobeUpdated = true;
   this->SetNumberOfOutputs(4);
@@ -71,20 +62,15 @@ MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
 }
 
 
-template <class TInputImage, class TOutputMetricImage, class TOutputImage, class TKernel>
-MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::~ MeanShiftImageFilter2()
 {
-  // if (m_Neighborhood)
-//     {
 
- //    }
-   delete[] m_Kernel;
-   delete[] m_SpatialKernel;
-   delete[] m_RangeKernel;
 }
 
 
+/*
 // to be replaced with new and generic method
 template <class TInputImage, class TOutputMetricImage, class TOutputImage, class TKernel>
 void MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
@@ -186,11 +172,11 @@ void MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel
 
       }
 }
+*/
 
-
-template <class TInputImage, class TOutputMetricImage, class TOutputImage, class TKernel>
-const typename MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>::OutputImageType *
-MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
+const typename MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>::OutputImageType *
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::GetSpatialOutput() const
 {
   if (this->GetNumberOfOutputs() < 1)
@@ -200,9 +186,9 @@ MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
   return static_cast<const OutputImageType *>(this->itk::ProcessObject::GetOutput(0));
 }
 
-template <class TInputImage, class TOutputMetricImage, class TOutputImage, class TKernel>
-typename MeanShiftImageFilter2<TInputImage,TOutputMetricImage,TOutputImage, TKernel>::OutputImageType *
-MeanShiftImageFilter2<TInputImage, TOutputMetricImage,TOutputImage, TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
+typename MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>::OutputImageType *
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::GetSpatialOutput()
 {
   if (this->GetNumberOfOutputs() < 1)
@@ -213,9 +199,9 @@ MeanShiftImageFilter2<TInputImage, TOutputMetricImage,TOutputImage, TKernel>
 }
 
 
-template <class TInputImage,  class TOutputMetricImage,class TOutputImage, class TKernel>
-const typename MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>::OutputImageType *
-MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
+const typename MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>::OutputImageType *
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::GetRangeOutput() const
 {
   if (this->GetNumberOfOutputs() < 2)
@@ -225,9 +211,9 @@ MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
   return static_cast<const OutputImageType *>(this->itk::ProcessObject::GetOutput(1));
 }
 
-template <class TInputImage, class TOutputMetricImage, class TOutputImage, class TKernel>
-typename MeanShiftImageFilter2<TInputImage, TOutputMetricImage,TOutputImage, TKernel>::OutputImageType *
-MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
+typename MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>::OutputImageType *
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::GetRangeOutput()
 {
   if (this->GetNumberOfOutputs() < 2)
@@ -238,9 +224,9 @@ MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
 }
 
 
-template <class TInputImage,  class TOutputMetricImage,class TOutputImage, class TKernel>
-const typename MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>::OutputMetricImageType *
-MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
+const typename MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>::OutputMetricImageType *
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::GetMetricOutput() const
 {
   if (this->GetNumberOfOutputs() < 3)
@@ -251,9 +237,9 @@ MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
 }
 
 
-template <class TInputImage, class TOutputMetricImage, class TOutputImage, class TKernel>
-typename MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>::OutputMetricImageType *
-MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
+typename MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>::OutputMetricImageType *
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::GetMetricOutput()
 {
   if (this->GetNumberOfOutputs() < 3)
@@ -263,9 +249,9 @@ MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
   return static_cast<OutputMetricImageType *>(this->itk::ProcessObject::GetOutput(2));
 }
 
-template <class TInputImage,  class TOutputMetricImage,class TOutputImage, class TKernel>
-typename MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>::OutputIterationImageType *
-MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
+typename MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>::OutputIterationImageType *
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::GetIterationOutput()
 {
   if (this->GetNumberOfOutputs() < 4)
@@ -275,9 +261,22 @@ MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
   return static_cast<OutputIterationImageType *>(this->itk::ProcessObject::GetOutput(3));
 }
 
-template <class TInputImage,class TOutputMetricImage, class TOutputImage, class TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
+const typename MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>::OutputIterationImageType *
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
+::GetIterationOutput() const
+{
+  if (this->GetNumberOfOutputs() < 4)
+    {
+      return 0;
+    }
+  return static_cast<OutputIterationImageType *>(this->itk::ProcessObject::GetOutput(3));
+}
+
+
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
 void
-MeanShiftImageFilter2<TInputImage, TOutputMetricImage, TOutputImage, TKernel>
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::AllocateOutputs()
 {
 
@@ -301,9 +300,9 @@ MeanShiftImageFilter2<TInputImage, TOutputMetricImage, TOutputImage, TKernel>
  }
 
 
-template <class TInputImage,class TOutputMetricImage, class TOutputImage, class TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
 void
-MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::Initialize()
  {
   // nothing to do
@@ -317,9 +316,9 @@ MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
  */
 
 
-template <class TInputImage,class TOutputMetricImage, class TOutputImage, class TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
 void
-MeanShiftImageFilter2<TInputImage, TOutputMetricImage, TOutputImage, TKernel>
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::GenerateOutputInformation()
 {
   Superclass::GenerateOutputInformation();
@@ -340,9 +339,9 @@ MeanShiftImageFilter2<TInputImage, TOutputMetricImage, TOutputImage, TKernel>
 }
 
 
-template <class TInputImage,class TOutputMetricImage, class TOutputImage, class TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
 void
-MeanShiftImageFilter2<TInputImage, TOutputMetricImage, TOutputImage, TKernel>
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::GenerateInputRequestedRegion()
 {
   // Call superclass implementation
@@ -369,10 +368,15 @@ MeanShiftImageFilter2<TInputImage, TOutputMetricImage, TOutputImage, TKernel>
 
   // spatial and range radius may differ, padding must be done with the largest.
   //unsigned int largestRadius= this->GetLargestRadius();
-  InputSizeType largestRadius= this->GetLargestRadius();
+  // SHE: commented out, only the spatial radius has an effect on the input region size
+  //InputSizeType largestRadius= this->GetLargestRadius();
   // Pad by the appropriate radius
   RegionType inputRequestedRegion  = outputRequestedRegion;
-  inputRequestedRegion.PadByRadius(largestRadius);
+
+  m_SpatialKernel.SetBandwidth(m_SpatialBandwidth);
+  m_SpatialRadius.Fill(m_SpatialKernel.GetRadius());
+
+  inputRequestedRegion.PadByRadius(m_SpatialRadius);
 
   // crop the input requested region at the input's largest possible region
    if ( inputRequestedRegion.Crop(inPtr->GetLargestPossibleRegion()) )
@@ -399,9 +403,9 @@ MeanShiftImageFilter2<TInputImage, TOutputMetricImage, TOutputImage, TKernel>
 }
 
 
-template <class TInputImage,class TOutputMetricImage, class TOutputImage, class TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
 void
-MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::BeforeThreadedGenerateData()
 {
 
@@ -409,24 +413,27 @@ MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
   TOutputImage * outSpatialPtr   = this->GetSpatialOutput();
   TOutputImage * outRangePtr   = this->GetRangeOutput();
 
-  // each value is tested
-  m_HasConverged=false;
-
   //TODO define generic case for the Kernel
-  this->CreateUniformKernel();
+  //this->CreateUniformKernel();
+  m_SpatialKernel.SetBandwidth(m_SpatialBandwidth);
+  m_RangeKernel.SetBandwidth(m_RangeBandwidth);
+
+  m_SpatialRadius.Fill(m_SpatialKernel.GetRadius());
+
 }
 
 
 // returns input spatial neighborhood, range, and binary map for boundaries
-template <class TInputImage,class TOutputMetricImage, class TOutputImage, class TKernel>
-typename MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>::OutputMetricPixelType  MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
+typename MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>::OutputMetricPixelType
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::CalculateMeanShiftVector(OutputPixelType *neighborhood,OutputPixelType spatialPixel,OutputPixelType rangePixel)
  {
   //std::cout<<"calculate mean shift vector"<<std::endl;
   OutputMetricPixelType meanShiftVector;
   OutputMetricPixelType weightingMeanShiftVector;
   // Kernel*Input //
-  InputSizeType kernelSize = this->GetLargestRadius();
+  InputSizeType kernelSize = m_SpatialRadius;
 
   unsigned int numberOfPixels= kernelSize[0]*kernelSize[1];
   //std::cout<<"number of pix "<<numberOfPixels<<std::endl;
@@ -442,8 +449,6 @@ typename MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKe
 
   // use only m_Kernel : need to define a concatenate output not spatial and range
   OutputPixelType *it = neighborhood;
-  OutputPixelType *spatialIt = m_SpatialKernel;
-  OutputPixelType *rangeIt = m_RangeKernel;
 
   //std::cout<<"start processing"<<std::endl;
   double neighborhoodValue;
@@ -473,7 +478,7 @@ typename MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKe
           {
 
           neighborhoodValue = it->GetElement(comp + spatialNumberOfComponents);
-          el = (neighborhoodValue - rangePixel[comp]) / m_SpectralBandwidth;
+          el = (neighborhoodValue - rangePixel[comp]) / m_RangeBandwidth;
 
           diff += el * el;
 
@@ -509,11 +514,9 @@ typename MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKe
 
         }
       ++it;
-      ++rangeIt;
-      ++spatialIt;
       }
     }
-  
+
   for(unsigned int comp=0; comp<spatialNumberOfComponents; comp++)
     {
       if( weightingMeanShiftVector[comp]>0)
@@ -532,16 +535,17 @@ typename MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKe
 
   return meanShiftVector;
  }
-  
+
 
 // returns input spatial neighborhood, range, and binarry map for boundaries
-template <class TInputImage,class TOutputMetricImage, class TOutputImage, class TKernel>
-void MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
+void
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::GetNeighborhood(OutputPixelType **neighborhood,PointType latticePosition)
  {
 
   typename InputImageType::ConstPointer input = this->GetInput();
-  InputSizeType kernelSize = this->GetLargestRadius();
+  InputSizeType kernelSize = m_SpatialRadius;
 
   unsigned int numberOfPixels = kernelSize[0] * kernelSize[1];
   //std::cout<<"number of pix "<<numberOfPixels<<std::endl;
@@ -627,9 +631,9 @@ void MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel
 }
 
 
-template <class TInputImage,class TOutputMetricImage, class TOutputImage, class TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
 void
-MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::ThreadedGenerateData(const OutputRegionType& outputRegionForThread, int threadId)
 {
   // at the first iteration
@@ -670,18 +674,18 @@ MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
   OutputIteratorType spatialIt(spatialOutput, outputRegionForThread);
   OutputMetricIteratorType metricIt(metricOutput, outputRegionForThread);
   OutputIterationIteratorType iterationIt(iterationOutput, outputRegionForThread);
-  
+
   // fill pixel
   rangeIt.GoToBegin();
   spatialIt.GoToBegin();
   metricIt.GoToBegin();
   iterationIt.GoToBegin();
-  
+
   unsigned int spatialNumberOfComponents = spatialOutput->GetNumberOfComponentsPerPixel();
   unsigned int rangeNumberOfComponents = rangeOutput->GetNumberOfComponentsPerPixel();
   unsigned int numberOfComponents = spatialNumberOfComponents + rangeNumberOfComponents;
 
-  InputSizeType kernelSize = this->GetLargestRadius();
+  InputSizeType kernelSize = m_SpatialRadius;
   OutputPixelType *neighborhood = new OutputPixelType[kernelSize[0] * kernelSize[1]];
   unsigned int iteration = 0;
 
@@ -779,9 +783,9 @@ MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
 
 
 /* after threaded convergence test */
-template <class TInputImage,class TOutputMetricImage, class TOutputImage, class TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
 void
-MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::AfterThreadedGenerateData()
 {
 
@@ -789,14 +793,14 @@ MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
 }
 
 
-template <class TInputImage,class TOutputMetricImage, class TOutputImage, class TKernel>
+template <class TInputImage, class TOutputImage, class TKernel, class TNorm, class TOutputMetricImage, class TOutputIterationImage>
 void
-MeanShiftImageFilter2<TInputImage,TOutputMetricImage, TOutputImage, TKernel>
+MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricImage, TOutputIterationImage>
 ::PrintSelf(std::ostream& os, itk::Indent indent) const
 {
   Superclass::PrintSelf(os, indent);
-  os << indent << "Spatial radius: "                << m_SpatialRadius               << std::endl;
-  os << indent << "Range radius: "                  << m_RangeRadius                 << std::endl;
+  os << indent << "Spatial bandwidth: "                << m_SpatialBandwidth               << std::endl;
+  os << indent << "Range bandwidth: "                  << m_RangeBandwidth                 << std::endl;
  }
 
 } // end namespace otb
diff --git a/Code/OBIA/otbMeanShiftConnectedComponentSegmentationFilter.h b/Code/OBIA/otbMeanShiftConnectedComponentSegmentationFilter.h
index b8c7cb1134ce5fa65501e3bb66e13ade8cf05e29..6cb6b05ef0679f5057de6108c925a113d56d5115 100644
--- a/Code/OBIA/otbMeanShiftConnectedComponentSegmentationFilter.h
+++ b/Code/OBIA/otbMeanShiftConnectedComponentSegmentationFilter.h
@@ -94,7 +94,7 @@ public:
 
   typedef double KernelType;
   typedef otb::MeanShiftImageFilter2
-      <VectorImageType, VectorImageType, VectorImageType, KernelType>
+      <VectorImageType, VectorImageType>
   MeanShiftFilterType;
 
   typedef typename MeanShiftFilterType::Pointer MeanShiftFilterPointerType;
diff --git a/Testing/Code/BasicFilters/CMakeLists.txt b/Testing/Code/BasicFilters/CMakeLists.txt
index b7b984543e7a10071a9a1a57aa0cf3ee74b15735..f07616d03d8d78ad22c81b7b574c069112939fe4 100644
--- a/Testing/Code/BasicFilters/CMakeLists.txt
+++ b/Testing/Code/BasicFilters/CMakeLists.txt
@@ -1133,7 +1133,7 @@ ADD_TEST(bfTvMeanShiftImageFilterValid ${BASICFILTERS_TESTS9}
         ${TEMP}/bfMeanShiftImageFilterClusterBoundariesOutputValid.tif
         4 50 10 1.0
         )
-              
+
 ADD_TEST(bfTvMeanShiftImageFilter2 ${BASICFILTERS_TESTS9}
         otbMeanShiftImageFilter2
         ${INPUTDATA}/QB_Suburb.png
@@ -1141,9 +1141,9 @@ ADD_TEST(bfTvMeanShiftImageFilter2 ${BASICFILTERS_TESTS9}
         ${TEMP}/bfMeanShiftImageFilterSpectralOutput.tif
         ${TEMP}/bfMeanShiftImageFilterMetricOutput.tif
         ${TEMP}/bfMeanShiftImageFilterIterationOutput.tif
-        8 4 50 10 0.000001 15
+        4 10 0.000001 15
         )
-        
+
 ADD_TEST(bfTvMeanShiftVectorImageFilterValidMul ${BASICFILTERS_TESTS9}
         otbMeanShiftVectorImageFilter
         ${INPUTDATA}/ROI_QB_MUL_4.tif
@@ -1152,9 +1152,9 @@ ADD_TEST(bfTvMeanShiftVectorImageFilterValidMul ${BASICFILTERS_TESTS9}
         ${TEMP}/bfMeanShiftImageFilterLabeledClusteredOutputValidMul.tif
         ${TEMP}/bfMeanShiftImageFilterClusterBoundariesOutputValidMul.tif
         4 50 10 1.0
-        )        
-     
-        
+        )
+
+
 ADD_TEST(bfTvMeanShiftImageFilter2Mul ${BASICFILTERS_TESTS9}
         otbMeanShiftImageFilter2
         ${INPUTDATA}/ROI_QB_MUL_4.tif
@@ -1162,11 +1162,11 @@ ADD_TEST(bfTvMeanShiftImageFilter2Mul ${BASICFILTERS_TESTS9}
         ${TEMP}/bfMeanShiftImageFilterSpectralOutputMul.tif
         ${TEMP}/bfMeanShiftImageFilterMetricOutputMul.tif
         ${TEMP}/bfMeanShiftImageFilterIterationOutputMul.tif
-        8 4 50 10 1 100
+        4 10 1 100
         )
-        
-  
-            
+
+
+
 IF(OTB_DATA_USE_LARGEINPUT)
 #
 #ADD_TEST(bfTvMeanShiftImageFilterValidLargeInput ${BASICFILTERS_TESTS9}
@@ -1178,7 +1178,7 @@ IF(OTB_DATA_USE_LARGEINPUT)
 #        ${TEMP}/bfMeanShiftImageFilterClusterBoundariesOutputValidLargeInput.tif
 #        9 50 10 1.0
 #        )
-        
+
 #ADD_TEST(bfTvMeanShiftImageFilter2LargeInput ${BASICFILTERS_TESTS9}
 #       otbMeanShiftImageFilter2
 #        ${LARGEINPUT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_MUL/02APR01105228-M1BS-000000128955_01_P001.TIF
@@ -1187,7 +1187,7 @@ IF(OTB_DATA_USE_LARGEINPUT)
 #       ${TEMP}/bfMeanShiftImageFilterMetricOutputLargeInput.tif
 #        9 9 10 10 0.001 10
 #        )
-        
+
 ENDIF(OTB_DATA_USE_LARGEINPUT)
 
 
diff --git a/Testing/Code/BasicFilters/otbMeanShiftImageFilter2.cxx b/Testing/Code/BasicFilters/otbMeanShiftImageFilter2.cxx
index 77c3456bf929ed7599239d97180b09823a945e43..3f49126a894c63c114796dbbd5dd39b46f9d7603 100644
--- a/Testing/Code/BasicFilters/otbMeanShiftImageFilter2.cxx
+++ b/Testing/Code/BasicFilters/otbMeanShiftImageFilter2.cxx
@@ -24,11 +24,10 @@
 
 int otbMeanShiftImageFilter2(int argc, char * argv[])
 {
-  std::cout << "coucou" << std::endl;
-  if (argc != 12)
+  if (argc != 10)
     {
     std::cerr << "Usage: " << argv[0] <<
-    " infname spatialfname spectralfname metricfname spatialRadius spectralRadius spectralbandwidth spatialBandwidth threshold maxiterationnumber"
+    " infname spatialfname spectralfname metricfname iterationfname spatialBandwidth rangeBandwidth threshold maxiterationnumber"
               << std::endl;
     return EXIT_FAILURE;
     }
@@ -38,12 +37,10 @@ int otbMeanShiftImageFilter2(int argc, char * argv[])
   const char *       spectralfname             = argv[3];
   const char *       metricfname               = argv[4];
   const char *       iterationfname            = argv[5];
-  const unsigned int spatialRadius             = atoi(argv[6]);
-  const unsigned int spectralRadius            = atoi(argv[7]);
-  const double       spectralbandwidth         = atof(argv[8]);
-  const double       spatialbandwidth          = atof(argv[9]);
-  const double       threshold                 = atof(argv[10]);
-  const unsigned int maxiterationnumber        = atoi(argv[11]);
+  const double       spatialBandwidth          = atof(argv[6]);
+  const double       rangeBandwidth            = atof(argv[7]);
+  const double       threshold                 = atof(argv[8]);
+  const unsigned int maxiterationnumber        = atoi(argv[9]);
   /* maxit - threshold */
 
   const unsigned int Dimension = 2;
@@ -52,7 +49,7 @@ int otbMeanShiftImageFilter2(int argc, char * argv[])
   typedef otb::VectorImage<PixelType, Dimension>          ImageType;
   typedef otb::ImageFileReader<ImageType>                 ReaderType;
   typedef otb::ImageFileWriter<ImageType>                 WriterType;
-  typedef otb::MeanShiftImageFilter2<ImageType, ImageType,ImageType,KernelType> FilterType;
+  typedef otb::MeanShiftImageFilter2<ImageType, ImageType> FilterType;
   typedef FilterType::OutputIterationImageType IterationImageType;
   typedef otb::ImageFileWriter<IterationImageType> IterationWriterType;
 
@@ -62,18 +59,9 @@ int otbMeanShiftImageFilter2(int argc, char * argv[])
 
   reader->SetFileName(infname);
 
-  //define square radius
-  ImageType::SizeType radius;
-  radius[0]=spatialRadius;
-  radius[1]=spatialRadius;
-
-  filter->SetSpatialRadius(radius);
-
-  radius[0]=spectralRadius;
-  radius[1]=spectralRadius;
-  filter->SetRangeRadius(radius);
-  filter->SetSpectralBandwidth(spectralbandwidth);
-  filter->SetSpatialBandwidth(spatialbandwidth);
+  // Set filter parameters
+  filter->SetSpatialBandwidth(spatialBandwidth);
+  filter->SetRangeBandwidth(rangeBandwidth);
   filter->SetThreshold(threshold);
   filter->SetMaxIterationNumber(maxiterationnumber);
   filter->SetInput(reader->GetOutput());
diff --git a/Testing/Code/BasicFilters/otbMeanShiftImageFilterNew2.cxx b/Testing/Code/BasicFilters/otbMeanShiftImageFilterNew2.cxx
index 5865499309e35e899711c96c140f46c8cf5fb4f1..54d49f33ffce6f955d87785f073fa83c8ad09e73 100644
--- a/Testing/Code/BasicFilters/otbMeanShiftImageFilterNew2.cxx
+++ b/Testing/Code/BasicFilters/otbMeanShiftImageFilterNew2.cxx
@@ -24,10 +24,9 @@ int otbMeanShiftImageFilterNew2(int argc, char * argv[])
   const unsigned int Dimension = 2;
   typedef short                                           PixelType;
   typedef double                                          OutputPixelType;
-  typedef double                                          KernelType;
   typedef otb::VectorImage<OutputPixelType, Dimension>          OutputImageType;
   typedef otb::VectorImage<PixelType, Dimension>                ImageType;
-  typedef otb::MeanShiftImageFilter2<ImageType, OutputImageType, OutputImageType,KernelType> FilterType;
+  typedef otb::MeanShiftImageFilter2<ImageType, OutputImageType> FilterType;
 
   // Instantiating object
   FilterType::Pointer filter = FilterType::New();
diff --git a/Testing/Code/OBIA/CMakeLists.txt b/Testing/Code/OBIA/CMakeLists.txt
index 54f91ccea42845170dcdd26621d9cd84b3c1c197..ceb0fe180626e79e88deb85ad97233b725a3212d 100644
--- a/Testing/Code/OBIA/CMakeLists.txt
+++ b/Testing/Code/OBIA/CMakeLists.txt
@@ -153,10 +153,8 @@ ADD_TEST(obTuMeanShiftStreamingConnectedComponentSegmentationOBIAToVectorDataFil
       otbMeanShiftStreamingConnectedComponentSegmentationOBIAToVectorDataFilter
       ${INPUTDATA}/ROI_QB_MUL_4.tif
       ${TEMP}/obTuMeanShiftStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.shp
-      9 
-      9 
-      50 
-      10 
+      9
+      10
       0.001
       ""
       "distance<10"
@@ -169,15 +167,15 @@ ADD_TEST(obTuMeanShiftConnectedComponentSegmentationFilter ${OBIA_TESTS1}
       otbMeanShiftConnectedComponentSegmentationFilter
       ${INPUTDATA}/ROI_QB_MUL_4.tif
       ${TEMP}/obTuMeanShiftConnectedComponentSegmentationImage.png
-      9 
-      9 
-      50 
-      10 
+      9
+      9
+      50
+      10
       0.01
       ""
       "distance<0.2"
       50)
-      
+
 
 
 
@@ -224,7 +222,7 @@ ADD_TEST(obTvHooverInstanceFilterToAttributeImage ${OBIA_TESTS1}
 
 ADD_TEST(obTuLabelImageToVectorDataFilterNew ${OBIA_TESTS1}
     otbLabelImageToVectorDataFilterNew)
-    
+
 ADD_TEST(obTvLabelImageToVectorDataFilter ${OBIA_TESTS1}
     --compare-ogr ${NOTOL}
     ${BASELINE_FILES}/obTuLabelImageToVectorDataFilter.shp
@@ -237,7 +235,7 @@ ADD_TEST(obTvLabelImageToVectorDataFilter ${OBIA_TESTS1}
 
 ADD_TEST(obTuLabelImageToOGRDataSourceFilterNew ${OBIA_TESTS1}
     otbLabelImageToOGRDataSourceFilterNew)
-    
+
 ADD_TEST(obTvLabelImageToOGRDataSourceFilter ${OBIA_TESTS1}
     otbLabelImageToOGRDataSourceFilter
     ${INPUTDATA}/labelImage_UnsignedChar.tif
diff --git a/Testing/Code/OBIA/otbMeanShiftConnectedComponentSegmentationFilterTest.cxx b/Testing/Code/OBIA/otbMeanShiftConnectedComponentSegmentationFilterTest.cxx
index 4fdac54400219ff27caac283687418983178f844..f7fbf5ba134c87a6d0f5984e23ec7691755321d4 100644
--- a/Testing/Code/OBIA/otbMeanShiftConnectedComponentSegmentationFilterTest.cxx
+++ b/Testing/Code/OBIA/otbMeanShiftConnectedComponentSegmentationFilterTest.cxx
@@ -24,7 +24,6 @@
 
 typedef float InputPixelType;
 const unsigned int Dimension = 2;
-typedef double                                          KernelType;
 typedef otb::Image<unsigned int, Dimension>             LabelImageType;
 typedef otb::Image<unsigned int, Dimension>             MaskImageType;
 
@@ -38,7 +37,7 @@ typedef otb::MeanShiftConnectedComponentSegmentationFilter
   < ImageType, MaskImageType,
     LabelImageType >  MeanShiftConnectedComponentsegmentationFilterType;
 
-typedef otb::MeanShiftImageFilter2<ImageType, ImageType,ImageType,KernelType> MeanShiftFilterType;
+typedef otb::MeanShiftImageFilter2<ImageType, ImageType> MeanShiftFilterType;
 
 
 int otbMeanShiftConnectedComponentSegmentationFilter(int argc, char * argv[])
@@ -50,17 +49,15 @@ int otbMeanShiftConnectedComponentSegmentationFilter(int argc, char * argv[])
   const char * outputFilename = argv[2];
 
   /* mean shift parameters */
-  const unsigned int spatialRadius = atoi(argv[3]);
-  const unsigned int spectralRadius = atoi(argv[4]);
-  const double spectralbandwidth = atof(argv[5]);
-  const double spatialbandwidth = atof(argv[6]);
-  const double threshold = atof(argv[7]);
+  const double spatialBandwidth = atof(argv[3]);
+  const double rangeBandwidth = atof(argv[4]);
+  const double threshold = atof(argv[5]);
 
   /* conencted component parameters */
 
-  const char * maskexpression = argv[8];
-  const char * segmentationexpression = argv[9];
-  unsigned int minobjectsize = atoi(argv[10]);
+  const char * maskexpression = argv[6];
+  const char * segmentationexpression = argv[7];
+  unsigned int minobjectsize = atoi(argv[8]);
 
    // add meanshift options
 
@@ -73,18 +70,9 @@ int otbMeanShiftConnectedComponentSegmentationFilter(int argc, char * argv[])
 
   reader->SetFileName(infname);
 
-  //define square radius
-  ImageType::SizeType radius;
-  radius[0] = spatialRadius;
-  radius[1] = spatialRadius;
+  meanShiftFilter->SetSpatialBandwidth(spatialBandwidth);
 
-  meanShiftFilter->SetSpatialRadius(radius);
-
-  radius[0] = spectralRadius;
-  radius[1] = spectralRadius;
-  meanShiftFilter->SetRangeRadius(radius);
-  meanShiftFilter->SetSpectralBandwidth(spectralbandwidth);
-  meanShiftFilter->SetSpatialBandwidth(spatialbandwidth);
+  meanShiftFilter->SetRangeBandwidth(rangeBandwidth);
   meanShiftFilter->SetThreshold(threshold);
 
   meanShiftFilter->SetInput(reader->GetOutput());
diff --git a/Testing/Code/OBIA/otbMeanShiftStreamingConnectedComponentOBIATest.cxx b/Testing/Code/OBIA/otbMeanShiftStreamingConnectedComponentOBIATest.cxx
index 7145a0d8602d09571f51bb4339c438ab62c719c7..78f0e6703da7ffbd3998ea8f21cba58fe32cea3c 100644
--- a/Testing/Code/OBIA/otbMeanShiftStreamingConnectedComponentOBIATest.cxx
+++ b/Testing/Code/OBIA/otbMeanShiftStreamingConnectedComponentOBIATest.cxx
@@ -25,7 +25,7 @@
 
 typedef float InputPixelType;
 const unsigned int Dimension = 2;
-typedef double                                          KernelType;
+
 typedef otb::Image<unsigned int, Dimension>             LabelImageType;
 typedef otb::Image<unsigned int, Dimension>             MaskImageType;
 
@@ -47,7 +47,7 @@ typedef otb::StreamingConnectedComponentSegmentationOBIAToVectorDataFilter
     MaskImageType,
     VectorDataType >  ConnectedComponentSegmentationOBIAToVectorDataFilterType;
 
-typedef otb::MeanShiftImageFilter2<ImageType, ImageType,ImageType,KernelType> MeanShiftFilterType;
+typedef otb::MeanShiftImageFilter2<ImageType, ImageType> MeanShiftFilterType;
 
 
 int otbMeanShiftStreamingConnectedComponentSegmentationOBIAToVectorDataFilter(int argc, char * argv[])
@@ -59,19 +59,17 @@ int otbMeanShiftStreamingConnectedComponentSegmentationOBIAToVectorDataFilter(in
   const char * outputFilename = argv[2];
 
   /* mean shift parameters */
-  const unsigned int spatialRadius = atoi(argv[3]);
-  const unsigned int spectralRadius = atoi(argv[4]);
-  const double spectralbandwidth = atof(argv[5]);
-  const double spatialbandwidth = atof(argv[6]);
-  const double threshold = atof(argv[7]);
+  const double spatialBandwidth = atof(argv[3]);
+  const double rangeBandwidth = atof(argv[4]);
+  const double threshold = atof(argv[5]);
 
   /* conencted component parameters */
 
-  const char * maskexpression = argv[8];
-  const char * segmentationexpression = argv[9];
-  unsigned int minobjectsize = atoi(argv[10]);
-  const char * obiaexpression = argv[11];
-  unsigned int nbstreams = atoi(argv[12]);
+  const char * maskexpression = argv[6];
+  const char * segmentationexpression = argv[7];
+  unsigned int minobjectsize = atoi(argv[8]);
+  const char * obiaexpression = argv[9];
+  unsigned int nbstreams = atoi(argv[10]);
 
   // add meanshift options
 
@@ -82,18 +80,9 @@ int otbMeanShiftStreamingConnectedComponentSegmentationOBIAToVectorDataFilter(in
 
   reader->SetFileName(infname);
 
-  //define square radius
-  ImageType::SizeType radius;
-  radius[0] = spatialRadius;
-  radius[1] = spatialRadius;
-
-  meanShiftFilter->SetSpatialRadius(radius);
+  meanShiftFilter->SetSpatialBandwidth(spatialBandwidth);
+  meanShiftFilter->SetRangeBandwidth(rangeBandwidth);
 
-  radius[0] = spectralRadius;
-  radius[1] = spectralRadius;
-  meanShiftFilter->SetRangeRadius(radius);
-  meanShiftFilter->SetSpectralBandwidth(spectralbandwidth);
-  meanShiftFilter->SetSpatialBandwidth(spatialbandwidth);
   meanShiftFilter->SetThreshold(threshold);
 
   meanShiftFilter->SetInput(reader->GetOutput());
diff --git a/Testing/Code/OBIA/otbStreamingVectorizedSegmentationOGR.cxx b/Testing/Code/OBIA/otbStreamingVectorizedSegmentationOGR.cxx
index cc295dfcb5465fe779b729a1611986635fca00b6..94d3df363a45cd45f08f3273b076cac5e44db15d 100644
--- a/Testing/Code/OBIA/otbStreamingVectorizedSegmentationOGR.cxx
+++ b/Testing/Code/OBIA/otbStreamingVectorizedSegmentationOGR.cxx
@@ -72,23 +72,23 @@ int otbStreamingVectorizedSegmentationOGR(int argc, char * argv[])
   //typedef otb::Image<InputPixelType,  Dimension>          ImageType;
   typedef otb::Image<unsigned int, Dimension>             LabelImageType;
   typedef double                                          KernelType;
-  
+
   //old mean shift filter
   typedef otb::MeanShiftVectorImageFilter<ImageType, ImageType, LabelImageType> SegmentationFilterType;
   //typedef otb::MeanShiftImageFilter<ImageType, ImageType, LabelImageType> SegmentationFilterType;
-  
-  
+
+
   //connectedComponnent filter
   /*typedef otb::Functor::ConnectedComponentMuParserFunctor<ImageType::PixelType>  FunctorType;
   typedef itk::ConnectedComponentFunctorImageFilter<ImageType, LabelImageType, FunctorType, LabelImageType > SegmentationFilterType;
   */
-  
+
   //New mean shift filter
   /*typedef otb::MeanShiftConnectedComponentSegmentationFilter
   < ImageType, LabelImageType, LabelImageType >  SegmentationFilterType; */
-  typedef otb::MeanShiftImageFilter2<ImageType,ImageType,ImageType,KernelType> MeanShiftFilterType;
-  
-  
+  typedef otb::MeanShiftImageFilter2<ImageType,ImageType> MeanShiftFilterType;
+
+
   typedef otb::StreamingVectorizedSegmentationOGR<ImageType, SegmentationFilterType> StreamingVectorizedSegmentationOGRType;
   typedef otb::ImageFileReader<ImageType>                      ReaderType;
 
@@ -97,20 +97,13 @@ int otbStreamingVectorizedSegmentationOGR(int argc, char * argv[])
   MeanShiftFilterType::Pointer meanShiftFilter = MeanShiftFilterType::New();
 
 
-  
+
   reader->SetFileName(argv[1]);
   reader->GenerateOutputInformation();
-  
-  
+
+
   //New Filter mean shift
-  ImageType::SizeType radius;
-  radius[0] = spatialRadius;
-  radius[1] = spatialRadius;
-  meanShiftFilter->SetSpatialRadius(radius);
-  radius[0] = spectralRadius;
-  radius[1] = spectralRadius;
-  meanShiftFilter->SetRangeRadius(radius);
-  meanShiftFilter->SetSpectralBandwidth(spectralbandwidth);
+  meanShiftFilter->SetRangeBandwidth(spectralbandwidth);
   meanShiftFilter->SetSpatialBandwidth(spatialbandwidth);
   meanShiftFilter->SetThreshold(threshold);
   meanShiftFilter->SetInput(reader->GetOutput());
@@ -120,7 +113,7 @@ int otbStreamingVectorizedSegmentationOGR(int argc, char * argv[])
   filter->GetSegmentationFilter()->SetMaskExpression(maskexpression);
   filter->GetSegmentationFilter()->SetConnectedComponentExpression(segmentationexpression);
   filter->GetSegmentationFilter()->SetMinimumObjectSize(minobjectsize); */
-  
+
   filter->SetInput(reader->GetOutput());
   //filter->GetStreamer()->SetNumberOfLinesStrippedStreaming(atoi(argv[3]));
   filter->GetStreamer()->SetTileDimensionTiledStreaming(atoi(argv[3]));
@@ -131,10 +124,10 @@ int otbStreamingVectorizedSegmentationOGR(int argc, char * argv[])
   filter->GetSegmentationFilter()->SetRangeRadius(15);
   filter->GetSegmentationFilter()->SetMinimumRegionSize(100);
   //filter->GetSegmentationFilter()->GetFunctor().SetExpression("distance<15");
-  
+
   filter->SetFileName(argv[2]);
   filter->Initialize(); //must do this after SetFileName and SetInput...
-  
+
   filter->Update();
 
   return EXIT_SUCCESS;