diff --git a/src/main/java/fr/pasteur/ida/zellige/main/Main.java b/src/main/java/fr/pasteur/ida/zellige/main/Main.java
index 9f3ce22b36012174f368c27bb06a9f7e0c69ddd7..86274dd2c8e67ffb4dc98a42b16c69e1d32cf27d 100644
--- a/src/main/java/fr/pasteur/ida/zellige/main/Main.java
+++ b/src/main/java/fr/pasteur/ida/zellige/main/Main.java
@@ -63,8 +63,10 @@ public class Main
 
         // Input of the image.
         final String imagePath =
-//        "doc/BG2.tif";
-        "C:\\Users\\ctrebeau\\Desktop\\MoucheAile\\STK\\STK_Mouche_c01_f0001_p005.tif";
+//        "doc/STK_060.tif";
+//        "C:\\Users\\ctrebeau\\Desktop\\MoucheAile\\STK\\STK_Mouche_c01_f0001_p005.tif";
+//        "C:\\Users\\ctrebeau\\Downloads\\phantom2b_combined.tif";
+                "C:\\Users\\ctrebeau\\Desktop\\HighRes\\STK_170706_Vangl2-Lp-wt_E14.5_Phall_cochlea_01bHighRes_c01_f0001_p002.tif";
         System.out.println(imagePath);
         // Creation of the image : version with unsigned type. */
         /* JY version for opening files. */
@@ -74,14 +76,16 @@ public class Main
 
 
         /* User Parameters AKA arguments to run the program*/
-        double percent = Double.parseDouble( args[ 0 ] );
-        int sigmas = Integer.parseInt( args[ 1 ] );
-        int delta = Integer.parseInt( args[ 2 ] );
+        double amplitude = Double.parseDouble( args[ 0 ] );
+        double threshold = Double.parseDouble( args[ 1 ] );
+        int sigmas = Integer.parseInt( args[ 2 ] );
+        int delta = Integer.parseInt( args[ 3 ] );
         /* End of parameters. */
 
 
         /* Print parameters.*/
-        System.out.println( " percent  : " + percent );
+        System.out.println( " amplitude  : " + amplitude );
+        System.out.println( " threshold  : " + threshold );
         System.out.println( " Blur size : " + sigmas );
         System.out.println( " Delta : " + delta );
         System.out.println( System.lineSeparator() );
@@ -96,7 +100,8 @@ public class Main
 
             SurfacesExtraction.setX( ( int ) stackImage.dimension( 0 ));// dimension X
             SurfacesExtraction.setY(( int ) stackImage.dimension( 1 ));// dimension Y
-            SurfacesExtraction.extract(stackImage,percent, sigmas, false, delta, false,
+            SurfacesExtraction.setZ(( int ) stackImage.dimension( 2 ));// dimension Z
+            SurfacesExtraction.extract(stackImage,amplitude,threshold, sigmas, false, delta, false,
                     false, true, "MIP");
         }
         else
diff --git a/src/main/java/fr/pasteur/ida/zellige/surfaceConstruction/construction/SurfacesExtraction.java b/src/main/java/fr/pasteur/ida/zellige/surfaceConstruction/construction/SurfacesExtraction.java
index aef14e0e91ebc90b2b61384fcfc2bc93c0818df5..666ba47e75185aba9e760f95a395bdde47585438 100644
--- a/src/main/java/fr/pasteur/ida/zellige/surfaceConstruction/construction/SurfacesExtraction.java
+++ b/src/main/java/fr/pasteur/ida/zellige/surfaceConstruction/construction/SurfacesExtraction.java
@@ -2,6 +2,7 @@ package fr.pasteur.ida.zellige.surfaceConstruction.construction;
 
 import java.util.ArrayList;
 
+import fr.pasteur.ida.zellige.utils.*;
 import org.jzy3d.analysis.AnalysisLauncher;
 
 import fr.pasteur.ida.zellige.exception.FirstRoundConstructionException;
@@ -15,13 +16,6 @@ import fr.pasteur.ida.zellige.surfaceConstruction.element.Surface;
 import fr.pasteur.ida.zellige.surfaceConstruction.element.os.OS;
 import fr.pasteur.ida.zellige.surfaceConstruction.element.os.OSList;
 import fr.pasteur.ida.zellige.surfaceConstruction.element.surfaceLine.SurfaceLine;
-import fr.pasteur.ida.zellige.utils.Interpolation;
-import fr.pasteur.ida.zellige.utils.IsolatedPixFilter;
-import fr.pasteur.ida.zellige.utils.LocalMaximumDetection;
-import fr.pasteur.ida.zellige.utils.LocalOtsu;
-import fr.pasteur.ida.zellige.utils.StackProjection;
-import fr.pasteur.ida.zellige.utils.Threshold;
-import fr.pasteur.ida.zellige.utils.Utils;
 import net.imglib2.RandomAccess;
 import net.imglib2.RandomAccessibleInterval;
 import net.imglib2.img.Img;
@@ -40,38 +34,24 @@ public class SurfacesExtraction
 {
     private static int X;
     private static int Y;
+    private static int Z;
     public static int zCount;
     public static TreeSet<Integer> list;
 
     public static < T extends RealType< T > & NativeType< T > > void extract(
-            Img< T > input, double percent, int sigmas,
+            Img< T > input, double amplitude,double threshold, int sigmas,
             boolean zMapDisplay, int delta,
             boolean extractedStackDisplay,
             boolean heightMapDisplay,
             boolean projectionDisplay,
             String projectionType )
     {
-        final long start = System.currentTimeMillis();
-        /* Pretreatment of the image.*/
-        Img< T > original = input.copy();
-        // Conversion into FloatType for the derivative computation (negative values)
-        Img< FloatType > converted = Utils.convertIntoFloatType( original.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 );
-
-        ImageJFunctions.show( normalized.copy(), "blurred " );
-        /* Local maximum search and selection */
-        Img< FloatType > maxIntensity = maximumSearch( normalized, percent, sigmas );
-        Pixels[][] maximums = buildPixelArray( maxIntensity );
-//        displayMaximums(maximums);
-        System.out.println(  System.currentTimeMillis() - start);
+        /* First step : Pixel selection */
+        Pixels[][] maximums = LocalMaximumSelection.run(input, amplitude,threshold, sigmas);
+
         try
         {
             /*  First round construction*/
-
             ArrayList< Surface > surfaces = firstRoundConstruction( maximums );
             System.out.println( "first round surfaces = " + surfaces.size() );
 //
@@ -408,6 +388,16 @@ public class SurfacesExtraction
         Y = y;
     }
 
+    public static int getZ()
+    {
+        return Z;
+    }
+
+    public static void setZ( int z )
+    {
+        Z = z;
+    }
+
     /**
      * Displays the local maximums found using jzy3D package.
      */