Login  Register

Re: Open a big tiff file.

Posted by Rasband, Wayne (NIH/NIMH) [E] on Jan 09, 2015; 6:23pm
URL: http://imagej.273.s1.nabble.com/Open-a-big-tiff-file-tp5011136p5011158.html

On Jan 8, 2015, at 3:14 PM, cri <[hidden email]> wrote:

>
> Hi all,
>
> I tried to use the BioFormats plugin for opening a big tiff file. An
> ImageStack is opened with the correct dimensions but all slices are
> completely dark. (All pixels are 0). Opening the image with File -> Open
> works. It is also possible to open the image by using Dataset.open() (the
> ImageJ2 style) but because I'm not very familiar with the new data
> structures, I'd prefer with staying with the ImageJ1 API for the moment.
> The image contains 500 slices (16 bits per pixel) with 2048x2048 pixels
> each.

You can open a tiff stack using

    img = IJ.openImage(path);

where ‘img' is an ImagePlus.

Or open it as a virtual stack using

    img = IJ.openVirtual(path);

which requires a lot less memory since images are only loaded as needed. IJ.openVirtual() requires the latest ImageJ daily build (1.49o16).

> Could you please tell me, how to open such a file or how to convert an
> ImageJ2-Dataset to an ImagePlus?

Question about ImageJ2 Datasets (still in beta) should be sent to the image-devel mailing list.

   http://imagej.net/mailman/listinfo/imagej-devel

-wayne

   

>
> Many thanks,
> cri
>
> The following code compiles without errors and opens a stack with dark
> slices only:
>
> public class BFTest implements PlugIn {
> static ImageJ ij;
>
> @Override
> public void run(final String arg) {
> String path="[1]Thu Nov 6 18-03-58 2014.tif";
>
> try {
> System.out.println("opening ...");
>
>                        //  this shows an image stack with correct
> dimensions but
>                        //  all pixels in each slice are 0
> ImagePlus[] imp=BF.openImagePlus(path);
> imp[0].show();
>
> System.out.println("done.");
> } catch (FormatException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> } catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
>
>
> public static void main(final String... args) {
> ij=new ImageJ();
> ij.ui().showUI();
>
> IJ.runPlugIn(BFTest.class.getName(), "");
> }
>
> }
>
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Open-a-big-tiff-file-tp5011136.html
> Sent from the ImageJ mailing list archive at Nabble.com.


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