Re: skipping "convert all images in stack to binary?"

Posted by Ben.BigHair on
URL: http://imagej.273.s1.nabble.com/skipping-convert-all-images-in-stack-to-binary-tp3698816p3698817.html

On Jul 18, 2007, at 4:12 PM, William Day wrote:

> I'm trying to automate a selection of tasks in a Java program, but  
> I can't
> let it run in the background because after I run("Convert to Mask")  
> I get
> prompted with "Convert all images in stack to binary?"
>

Hi,

This is a great time to use the macro recorder  
(Plugins>Macros>Record...) to see ImageJ expects for arguments to  
commands.  You can usually avoid the dialogs by populating the  
argument list.  For example...

Do these to converts the gray scale images in the stack to masks  
without prompting for a dialog.

run("MRI Stack (528K)");
run("Convert to Mask", "calculate black");

In the following the "calculate" argument is missing, but still no  
dialog.
run("MRI Stack (528K)");
run("Convert to Mask", "  black");

And finally, an empty string of arguments.  Still no dialog.
run("MRI Stack (528K)");
run("Convert to Mask", " ");

Pretty good stuff!

Cheers,
Ben


> Is there something I can set, or argument I can pass that will  
> avoid this
> dialog? I poked around in the Thresholder.java and didn't see any  
> trivial
> ways around it.
>
> --
> William Day

Ben Tupper
Bigelow Laboratory for Ocean Science
180 McKown Point Road
POB 475
West Boothbay Harbor, ME 04575