Re: ImageJ Macro (Do while loop) Problem

Posted by Michael Schmid on
URL: http://imagej.273.s1.nabble.com/ImageJ-Macro-Do-while-loop-Problem-tp3696117p3696121.html

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.