diff --git a/src/main/java/fr/pasteur/ida/zellige/utils/LocalMaximumSelection.java b/src/main/java/fr/pasteur/ida/zellige/utils/LocalMaximumSelection.java
index ad616b1d9f03910bc5f8ca5fd49432fe99d507ce..052f0dd3e87f574e8a71cac72961f0afe6f75687 100644
--- a/src/main/java/fr/pasteur/ida/zellige/utils/LocalMaximumSelection.java
+++ b/src/main/java/fr/pasteur/ida/zellige/utils/LocalMaximumSelection.java
@@ -15,51 +15,55 @@ import org.jzy3d.analysis.AnalysisLauncher;
 
 public class LocalMaximumSelection
 {
-    public static int zCount;
-    public static double processTime;
 
-    public static < T extends RealType< T > & NativeType< T > > Pixels[][] run( Img<T > source, double percent, int sigmas)
+
+
+    public static < T extends RealType< T > & NativeType< T > > Pixels[][] run( Img< T > source, double amplitude, double threshold, int sigmas )
     {
-        final long start = System.currentTimeMillis();
         /* Pretreatment of the image.*/
-        // Conversion into FloatType for the derivative computation (negative values)
-        Img< FloatType > converted = Utils.convertIntoFloatType( source.copy() );
-        //Image denoising with an anisotropic convolution
-        Utils.gaussConvolution( converted.copy(), converted, new double[]{ 1, 1, 0 } );
-        // Normalization for to simplify thresholding
-        Img< FloatType > normalized = Utils.normalizeImage( converted );
+        Img< FloatType > normalized = pretreatment( source );
         ImageJFunctions.show( normalized.copy(), "converted, blurred and normalized " );
 
         /* Local maximum search and selection */
-        Img< FloatType > maxIntensity = maximumSearch( normalized, percent, sigmas );
-        Pixels[][] maximums = buildPixelArray( maxIntensity );
+        Pixels[][] maximums  = maximumSearch( normalized, amplitude,threshold, sigmas );
 
-        /* Output and process time */
-        displayMaximums(maximums);
-        processTime =   System.currentTimeMillis() - start;
+        /* Output  */
+        displayMaximums( maximums );
         return maximums;
     }
 
-    private static < T extends RealType< T > & NativeType< T > > Img< T > maximumSearch( Img< T > input, double percent, int sigma )
+    private static < T extends RealType< T > & NativeType< T > >Img<FloatType> pretreatment(Img< T > source)
+    {
+        /* Pretreatment of the image.*/
+        // Conversion into FloatType for the derivative computation (negative values)
+        Img< FloatType > converted = Utils.convertIntoFloatType( source.copy() );
+        //Image denoising with an anisotropic convolution
+        Utils.gaussConvolution( converted.copy(), converted, new double[]{1, 1, 0 } );
+        // Normalization
+       return Utils.normalizeImage( converted );
+    }
+
+
+
+    private static < T extends RealType< T > & NativeType< T > > Pixels[][] maximumSearch( Img< T > input, double amplitude, double threshold, int sigma  )
     {
-        /* Local maximum detection using partial derivative */
-        Img< T > maximums = LocalMaximumDetection.findMaximums( input, input.factory() );
-        ImageJFunctions.show( maximums, "maximums" );
+        /* Grid of amplitude thresholds */
+        Img< FloatType > amplitudeImg = AmplitudeBackgroundForeGroundClassification.find(input,amplitude, 0.10);
+        ImageJFunctions.show( amplitudeImg," amplitude" );
 
-        /* Grid of local maximums*/
-        Img< BitType > threshold = LocalOtsu.find( input , percent);
-        //ImageJFunctions.show( threshold, "Local threshold " );
+        /* Grid of local thresholds*/
+        Img< BitType > thresholds = LocalOtsu.find( input, threshold );
 
-        /* Maxima selection according to threshold*/
-        maximums = Threshold.classification( maximums.copy(), maximums.factory(), threshold );
+        /* Pixel selection */
+        Img<FloatType> finalList = Threshold.classification( amplitudeImg,  amplitudeImg.factory(), thresholds );
 
         /* Dilatation of the resulting image*/
-        Utils.gaussConvolution( maximums.copy(), maximums, new double[]{ sigma, sigma } );
-//        ImageJFunctions.show( maximums, "blurred maximums" );
+        Utils.gaussConvolution( finalList.copy(), finalList, new double[]{ sigma, sigma } );
+        ImageJFunctions.show(finalList, "blurred maximums" );
 
-        /* New local maximum detection due to previous smoothing*/
-        maximums = LocalMaximumDetection.findMaximums( maximums.copy(), maximums.factory() );
-        return maximums;
+        /* Local maximum detection due to previous smoothing*/
+        finalList = LocalMaximumDetection.findMaximums( finalList.copy(), finalList.factory() );
+        return buildPixelArray( finalList );
     }
 
 
@@ -80,7 +84,6 @@ public class LocalMaximumSelection
                         if ( pixels[ y ][ x ] == null )
                         { // nothing yet
                             pixels[ y ][ x ] = new Pixels( new Coordinate( x, y, z ) );
-                            zCount++;
                         }
                         else // already at least two coordinates
                         {
@@ -92,6 +95,7 @@ public class LocalMaximumSelection
         }
         return pixels;
     }
+
     /**
      * Displays the local maximums found using jzy3D package.
      */
@@ -108,10 +112,4 @@ public class LocalMaximumSelection
         }
     }
 
-
-
-    public static double getProcessTime()
-    {
-        return processTime;
-    }
 }