Re: IJ.setAutoThreshold(...);
Posted by
BenTupper on
Aug 08, 2011; 6:48pm
URL: http://imagej.273.s1.nabble.com/IJ-setAutoThreshold-tp3683573p3683574.html
Hi,
On Aug 8, 2011, at 1:26 PM, ColinWhite wrote:
> Hi group,
>
> I'm trying to auto threshold an 8-bit image using the code below. However,
> this creates a NullPointerException and I don't understand why.
>
> IJ.setAutoThreshold(imp, "Mean dark");
> IJ.run(imp, "Convert to Mask", "");
>
I don't have any issues with the following java script on ImageJ 1.45l or the daily build (1.45m).
imp = IJ.openImage("
http://imagej.nih.gov/ij/images/blobs.gif");
imp.show();
IJ.log("imp is null? " + (imp == null));
IJ.setAutoThreshold(imp, "Mean dark");
IJ.run(imp, "Convert to Mask", "");
It seems that your image processor, imp, might not be what you are expecting it to be. You'll want to verify that the creation of your instance of the imp is successful, somewhere upstream of your commands.
Cheers,
Ben