Re: NullPointerException always thrown whne invoking "Enhance Local Contrast (CLAHE)" from java plugin
Posted by
Saalfeld, Stephan on
Aug 11, 2014; 4:15pm
URL: http://imagej.273.s1.nabble.com/NullPointerException-always-thrown-whne-invoking-Enhance-Local-Contrast-CLAHE-from-java-plugin-tp5009096p5009098.html
Please try:
ImagePlus image = IJ.openImage(currentImagePath);
image.show();
IJ.run(image, "Enhance Local Contrast (CLAHE)", "blocksize=127
histogram=256 maximum=3 mask=*None* fast_(less_accurate)");
image.updateImage();
The plugin's run method fails if the image isn't displayed. You may
want to use the API method directly instead of IJ.run(...) which is
better anyways and does not require the image to be shown:
mpicbg.ij.clahe.Flat.getFastInstance().run(
image,
63, // blockRadius
256, // bins
3.0f, // slope
null, // mask
false // composite
);
Does that work for you?
Best,
Stephan
On Mon, 2014-08-11 at 18:58 +0300, George H wrote:
> Hi,
>
> I am not sure why this is happening but I am always getting a
> NullpointerException on the second line with the invocation of IJ.run(....)
>
> ImagePlus image = IJ.openImage(currentImagePath);
> IJ.run(image, "Enhance Local Contrast (CLAHE)", "blocksize=127
> histogram=256 maximum=3 mask=*None* fast_(less_accurate)");
> image.updateImage();
>
> When I do it manually with record macro that's why shows up. How come in
> the Java plugin it throws a NullPointerException ?
>
> Thanks.
> --
> George
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html