Login  Register

Re: Problems running Versatile Wand in batch mode

Posted by Avital Steinberg on May 20, 2015; 9:33am
URL: http://imagej.273.s1.nabble.com/Problems-running-Versatile-Wand-in-batch-mode-tp5012873p5012883.html

Thanks, but the problem isn't solved. Can anyone else check if they're
having similar problems running this code? Does this code create a
selection in the saved image also for you?

setBatchMode(true);
open();
image1ID = getImageID();
open();
image2ID = getImageID();
selectImage(image1ID);
if(isActive(image1ID)){
    print("The first image is active");
}
else {
    print("The first image isn't active");
}

if(isActive(image2ID)){
    print("The second image is active");
}
else {
    print("The second image isn't active");
}
makePoint(1854, 726);
run("Gaussian Blur...", "sigma=2");
run("Set Scale...", "distance=0");
run("Versatile Wand", "value=60 color=-100 gradient=10
connectedness=8-connected x=2 y=2 do");
run("ROI Manager...");
roiManager("Add");
saveAs("Tiff");


I am using ImageJ 1.49t7, which came with Java 1.6.0_065 (64 bit). I am
running it on a mac, but I had the same problems also on a Linux machine
with ImageJ 1.49s and java 1.6.0_24.

MakePoint isn't needed, but it's besides the point, since the bug has
nothing to do with it and exists also without it.

Thanks,
Avital

On Tue, May 19, 2015 at 6:25 PM, Michael Schmid <[hidden email]>
wrote:

> Hi Avital,
>
> sorry, I can't reproduce the problem. Your macro works; it blurs the first
> image and does the wand selection on it. I also get the selection in the
> ROI Manager.
> I tried with both 8-bit grayscale as well as RGB images.
>
> What I don't understand is the "makePoint(1854, 726)" command; Gaussian
> Blur does not care about point selections. So it blurs the whole image.
>
> I am using ImageJ 1.49u4, Java 1.6.0_45.
>
> Michael
> ________________________________________________________________
> On May 19, 2015, at 17:01, Avital Steinberg wrote:
>
> > Hi,
> > I'm trying to use Versatile Wand in batch mode. The following macro works
> > well in batch mode:
> >
> > setBatchMode(true);
> > open();
> > makePoint(1854, 726);
> > run("Gaussian Blur...", "sigma=2");
> > run("Set Scale...", "distance=0");
> > run("Versatile Wand", "value=60 color=-100 gradient=10
> > connectedness=8-connected x=2 y=2 do");
> > run("ROI Manager...");
> > roiManager("Add");
> > saveAs("Tiff");
> >
> > However - when I try to work with multiple images, select the active
> image
> > and then use the Versatile Wand, no selection is created:
> >
> > setBatchMode(true);
> > open();
> > image1ID = getImageID();
> > open();
> > image2ID = getImageID();
> > selectImage(image1ID);
> > if(isActive(image1ID)){
> >    print("The first image is active");
> > }
> > else {
> >    print("The first image isn't active");
> > }
> >
> > if(isActive(image2ID)){
> >    print("The second image is active");
> > }
> > else {
> >    print("The second image isn't active");
> > }
> > makePoint(1854, 726);
> > run("Gaussian Blur...", "sigma=2");
> > run("Set Scale...", "distance=0");
> > run("Versatile Wand", "value=60 color=-100 gradient=10
> connectedness=8-connected x=2 y=2 do");
> > run("ROI Manager...");
> > roiManager("Add");
> > saveAs("Tiff");
> >
> > Why wouldn't this script work? Only one image is active.
> >
> > Thank you,
> > Avital
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html