Login  Register

Re: ImageJ Macro (Do while loop) Problem

Posted by degussa on May 28, 2008; 5:16pm
URL: http://imagej.273.s1.nabble.com/ImageJ-Macro-Do-while-loop-Problem-tp3696117p3696118.html

Thank you,
 I have solved the problem using the particle analysis route. I got this from a macro posted by LANDINI when going through the archive for  another issue i was trying to resolve. posted below is the modified Macro that does the selection i require.

setThreshold(110,800);

//run("Analyze Particles...", "size=26000-Infinity circularity=0.00-1.00 show=Nothing include record");

run("Analyze Particles...", "size=26000-Infinity circularity=0.00-1.00 show=Nothing clear include record");

run("Select None");

    x = getResult('XStart', 0);
    y = getResult('YStart', 0);

    doWand(x,y);

The macro works perfectly fine. thanks




degus wrote
Please i need some urgent help with a macro i am writing. The macro involves a loop, but the loop runs continously and does not terminate except i physically close imageJ.

Here is the loop part of the macro below,


setThreshold(110, 800);
                g = 100;
                b = 300;
        do {
                doWand(g, b);

                 run("Measure");
               
                Cplxarea = getResult("Area", 0);
               
                g = g + 10;
               
        }
       
        while (Cplxarea<26000);
run("ROI Manager...");
     roiManager("Add");
    selectImage(IDd);
     close

I want to take the complex region of interest in an image using the doWand command, but i need to be sure the doWand takea an area larger than 26000( this is actually dependent on the doWand position which varies from image to image. so i want to iterate until i can successfully  get a complex area with the doWand command larger than 26000 in area. The problem i get is that the looop runs continously and does not proceed to the next step. I appreciate your help. Thank you.

Degussa

        run("ROI Manager...");
     roiManager("Add");
    selectImage(IDd);
     close();