Login  Register

Re: Plugin to adjust threshold without opening window

Posted by Rasband, Wayne (NIH/NIMH) [E] on Feb 02, 2017; 11:29pm
URL: http://imagej.273.s1.nabble.com/Plugin-to-adjust-threshold-without-opening-window-tp5018002p5018012.html

On Feb 2, 2017, at 12:33 PM, kt7 <[hidden email]> wrote:

>
> Whenever I run the following code I get an error that no windows are open. I
> know that i could rewrite as: IJ.open("path"+(i)+".jpg"); however i am
> trying t save the runtime from opening the windows for 900 images.
> Thanks,
> Kyle
>
> for(int i=0; i<900; i++){
>                        ImagePlus image1 =IJ.openImage("path"+(i)+".jpg");
>                        ij.setThreshold(threshold, 255,"Black & White");
> }

Use

    IJ.setThreshold(image1, threshold, 255,"Black & White");

-wayne

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