ImageJ Macro (Do while loop) Problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

ImageJ Macro (Do while loop) Problem

degussa
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();
Reply | Threaded
Open this post in threaded view
|

Re: ImageJ Macro (Do while loop) Problem

lechristophe
It is difficult to answer your question without seeing your image, but
my guess is that you never reach the 26000 minimum area to exit the
loop. The wand is quite sensitive and it could be almost impossible
(depending on your image) to get a large area, as you sample only one
pixel out of 10 in one dimension to test for the wand.

Maybe you should try to do an Analyze Particle after tresholding (to
catch the big regions) and optionnally loop a doWand on the detected
regions, then report the ROI on your original image.

Christophe

On Sun, May 25, 2008 at 2:33 PM, degus <[hidden email]> 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();
> --
> View this message in context: http://www.nabble.com/ImageJ-Macro--%28Do-while-loop%29-Problem-tp17457474p17457474.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: ImageJ Macro (Do while loop) Problem

degussa
I cannot do a particle analysis for my image beacuse it is a solid block with pores. i attach a 16 bit image i am working with. I need the doWand to always select the region encomapssing the rock sample in totality. I need to cut off all areas outside the rock
lechristophe wrote
It is difficult to answer your question without seeing your image, but
my guess is that you never reach the 26000 minimum area to exit the
loop. The wand is quite sensitive and it could be almost impossible
(depending on your image) to get a large area, as you sample only one
pixel out of 10 in one dimension to test for the wand.

Maybe you should try to do an Analyze Particle after tresholding (to
catch the big regions) and optionnally loop a doWand on the detected
regions, then report the ROI on your original image.

Christophe

On Sun, May 25, 2008 at 2:33 PM, degus <degussa4@yahoo.com> 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();
> --
> View this message in context: http://www.nabble.com/ImageJ-Macro--%28Do-while-loop%29-Problem-tp17457474p17457474.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
MW24C2_REF1_S101V_cs0300.tif
Reply | Threaded
Open this post in threaded view
|

Re: ImageJ Macro (Do while loop) Problem

Michael Schmid
Hi,

you can use "Analyze Particles" also in this case; use the
following options:
Select "Include Holes" and deselect "Exclude on Edges".
In "Size", enter "26000-infinity"

With "Show:Masks" it will show the particle.

Michael
________________________________________________________________
On 27 May 2008, at 04:39, degus wrote:

> I cannot do a particle analysis for my image beacuse it is a solid  
> block with
> pores. i attach a 16 bit image i am working with. I need the doWand to
> always select the region encomapssing the rock sample in totality.  
> I need to
> cut off all areas outside the rock
>
> lechristophe wrote:
>>
>> It is difficult to answer your question without seeing your image,  
>> but
>> my guess is that you never reach the 26000 minimum area to exit the
>> loop. The wand is quite sensitive and it could be almost impossible
>> (depending on your image) to get a large area, as you sample only one
>> pixel out of 10 in one dimension to test for the wand.
>>
>> Maybe you should try to do an Analyze Particle after tresholding (to
>> catch the big regions) and optionnally loop a doWand on the detected
>> regions, then report the ROI on your original image.
>>
>> Christophe
>>
>> On Sun, May 25, 2008 at 2:33 PM, degus <[hidden email]> 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();
>>> --
>>> View this message in context:
>>> http://www.nabble.com/ImageJ-Macro--%28Do-while-loop%29-Problem- 
>>> tp17457474p17457474.html
>>> Sent from the ImageJ mailing list archive at Nabble.com.
>>>
>>
>>
> http://www.nabble.com/file/p17482052/MW24C2_REF1_S101V_cs0300.tif
> MW24C2_REF1_S101V_cs0300.tif
> --
> View this message in context: <a href="http://www.nabble.com/ImageJ-Macro--%">http://www.nabble.com/ImageJ-Macro--% 
> 28Do-while-loop%29-Problem-tp17457474p17482052.html
> Sent from the ImageJ mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: ImageJ Macro (Do while loop) Problem

degussa
In reply to this post by degussa
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();