Login  Register

Macro question

Posted by Christophe CHAMOT on Sep 13, 2005; 8:43am
URL: http://imagej.273.s1.nabble.com/Macro-question-tp3704801.html

Hello listers,

I've a question about macro. I made a macro to count the integrated
density of fluorescence in green stack based on a binary threshold of an
other color. I thought I'll be able to catch the different regions with
a wand on the binary image. And it works !!! On a single image.
But if I put this macro in a "for" loop to process stacks, it's
nonsense !
Just a clue, if I comment the "doWand" command, all the slices are
processed. (I work on linux, ImageJ 1.35b, java 1.6.0-ea but I tried
with older versions -1.33- under win XP).

Any idea is welcome. Thanks.

here's the code :


selectWindow("bleu.tif-copy");
run("Fill Holes", "stack");
for (i=1; i<=nSlices; i++){
        selectWindow("bleu.tif-copy");
        setSlice(i);
        nResAvant=nResults;
        run("Analyze Particles...", "minimum=25 maximum=999999 bins=2
show=Nothing display exclude slice");
        nResApres=nResults;
        nRes=nResApres-nResAvant;
        if (nRes != 0){
                for (j=0; j<nRes; j++){
                        indice=nResAvant+j;
                        centX=getResult("X", indice);
                        centY=getResult("Y", indice);
                        setTool(8);
                        doWand(centX, centY);
                        selectWindow("vert.tif");
                        setSlice(i);
                        run("Restore Selection");
                        run("Measure");
                        }
                }
        }


--
CHAMOT Christophe
---------------------------------------------------------------------
Plate-Forme de Recherche IFR117
"Imageries des Processus Dynamiques
en Biologie Cellulaire et Biologie du Développement "
Institut Jacques Monod, CNRS, Universités Paris 6 et 7
2, place Jussieu - Tour 43
75251 Paris cedex 05
Tel: 01 44 27 57 84
http://www.ijm.jussieu.fr/
---------------------------------------------------------------------