Login  Register

Re: IJ.openImage returning NULL after using BioFormats to open?

Posted by Curtis Rueden-2 on Aug 26, 2020; 2:59am
URL: http://imagej.273.s1.nabble.com/IJ-openImage-returning-NULL-after-using-BioFormats-to-open-tp5023882p5023883.html

Hi Kenneth,

> should I be surprised that the image is DISPLAYED?  My plugin wants
> the ImageProcessor, and will use it to create a custom ImagePlus (with
> a few minor extensions).

Try using the loci.plugins.BF API. It is intended for use from Java
libraries and plugins.

  import loci.plugins.BF;
  ...
  String file = "/path/to/your/data.hdr";
  ImagePlus[] imps = BF.openImagePlus(file);

If you need more control over how the images are opened, you can set them
using ImporterOptions; see here for details:

  https://imagej.net/Bio-Formats#Scripting

Regards,
Curtis

--
Curtis Rueden
Software architect, LOCI/Eliceiri lab - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
Have you tried the Image.sc Forum? https://forum.image.sc/



On Tue, Aug 25, 2020 at 2:34 PM Kenneth Sloan <[hidden email]>
wrote:

> I'm dealing with a new (to me) image format.  I have two very similar
> images, with extensions .hdr and .img.  Both behave the same.
>
> When I call (from Java):
>
>         ImagePlus ipl = IJ.openImage(path);
>
> ...the Bio-Formats Import Options screen appears.
> I accept all defaults (I've also tried "Standard ImageJ" instead of
> "Hyperstack") and a single image is displayed (perhaps it's actually a
> one-slice stack?)
>
> But, ipl is null!
>
> I'm going to workaround this by saving the image as a .tif and proceed
> from there - but I thought I'd ask: "what am I doing wrong"?
>
> Question 2 - should I be surprised that the image is DISPLAYED?  My plugin
> wants the ImageProcessor, and will use it to create a custom ImagePlus
> (with  a few minor extensions).  I'm guessing that once Bio-Formats is
> called, all bets are off?
>
> --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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