/**
 *
 */
package microTiPi.microUtils;

import mitiv.array.ArrayUtils;
import mitiv.base.Shape;
import mitiv.utils.Imager;
import mitiv.utils.TiPiHook;

/**
 * @author ferreol
 *
 */
public class DEMICSHook implements TiPiHook{

    private Imager curImager;
    private Shape outShape;
    private boolean debug;

    /**
     *
     */
    public DEMICSHook(Imager imager, Shape outShape, boolean debug) {
        this.curImager = imager;
        this.outShape = outShape;
        this.debug = debug;
    }
    /* (non-Javadoc)
     * @see mitiv.utils.TiPiHook#run(java.lang.Object, int)
     */
    @Override
    public void run(Object caller, int iter) {
        // TODO Auto-generated method stub
        curImager.show(ArrayUtils.crop(((MicroDeconvolution) caller).solver.getSolution(),outShape) ,"Current mu="+((MicroDeconvolution) caller).solver.getRegularizationLevel() +"it:"+((MicroDeconvolution) caller).solver.getIterations());

        if (debug){
            System.out.println("Cost "+((MicroDeconvolution) caller).solver.getCost() );
        }
    }


}

@@ -308,16 +308,47 @@
 n debug;
+%0A    private String title=null;
 %0A%0A    /*
@@ -416,16 +416,30 @@
 utShape,
+ String title,
  boolean
@@ -539,24 +539,52 @@
 ug = debug;%0A
+        this.title = title;%0A
     %7D%0A    /*
@@ -739,82 +739,82 @@
     
-// TODO Auto-generated method stub%0A        curImager.show(ArrayUtils.crop(
+String titlet;%0A        if(title==null)%0A            titlet = %22Current mu=%22+
 ((Mi
@@ -853,42 +853,35 @@
 .get
-Solution(),outShape) ,%22Current mu=
+RegularizationLevel() +%22it:
 %22+((
@@ -922,37 +922,102 @@
 .get
-RegularizationLevel() +%22it:%22+
+Iterations();%0A        else%0A            titlet = title;%0A        curImager.show(ArrayUtils.crop(
 ((Mi
@@ -1052,28 +1052,43 @@
 lver.get
-Itera
+Solu
 tion
-s
 ()
+,outShape),titlet
 );%0A%0A    

add titles in DEMIChooks