Login  Register

Re: Segmentation macro problems, still

Posted by seb-7 on Jun 30, 2006; 1:57pm
URL: http://imagej.273.s1.nabble.com/Segmentation-macro-problems-still-tp3702363p3702364.html

Andy Weller wrote:

> Dear all,
>
> Can anyone see any problems with the following macro? I can't for the
> life of me get it doing what I want it to do.
>
> In essence I want my segmented particle (bright foreground, black
> background) and its associated ROI saved, but all I keep getting is
> black and white images (black particle + specks, white background). I've
> tried all various settings I can think of (threshold, etc), but nothing.
> My current problem is this:
>
> The 'Particle Analyzer' box comes up with "A threshold image or 8-bit
> binary image is required. Threshold levels can ve set using the Image ->
> Adjust -> Threshold tool." I am doing this (see macro), but the strange
> thing is, it seems to work manually...?!
>
> Many thanks, Andy
>
> <MACRO>
>
>    setBatchMode(true);
[SNIP]

   save(fileName+".tif");
>    selectImage(mask);
>    run("Create Selection"); // requires 1.37j
>    selectImage(img);
>    run("Restore Selection");
>    save(fileName+".roi");


Hello Andy, hello ImageJers

I might be wrong, but I noticed some strange behaviours with the
setBatchMode(true) recently.
I don't know yet what's going wrong but when setBatchMode is set to
"true"  before some piece of macro code creating a new image it seems to
fail, at least with some combinations of ij/JRE.
I didn't post it because I had to check first on other ij installations.
Could you try without setBatchMode?

sebastien.