NullPointerException always thrown whne invoking "Enhance Local Contrast (CLAHE)" from java plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

NullPointerException always thrown whne invoking "Enhance Local Contrast (CLAHE)" from java plugin

George H
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
Reply | Threaded
Open this post in threaded view
|

Re: NullPointerException always thrown whne invoking "Enhance Local Contrast (CLAHE)" from java plugin

Saalfeld, Stephan
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
Reply | Threaded
Open this post in threaded view
|

Re: NullPointerException always thrown whne invoking "Enhance Local Contrast (CLAHE)" from java plugin

George H
Works great Stephan.
Thanks for that.
--
George


On Mon, Aug 11, 2014 at 7:15 PM, Stephan Saalfeld <
[hidden email]> wrote:

> 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
>

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