Open a big tiff file.

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

Open a big tiff file.

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

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

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(), "");
        }

}
Reply | Threaded
Open this post in threaded view
|

Re: Open a big tiff file.

ctrueden
Hi Christian,

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

Just to be absolutely sure: when you mouse over the image, the pixel probe
output (shown in the ImageJ main window status bar area) says 0 for
everything, right?

If not, then see:
http://imagej.net/FAQ#The_image_I_loaded_is_displayed_all_black.21_But_it_is_not_black.21

If the data is indeed being read as all zeroes, but you know it isn't all
zeroes (i.e., another image program reads the values correctly), then could
you please upload a sample file illustrating the problem? You can use the
Help > Upload Sample Image command. Then reply back and let us know the
name of the image you uploaded. The image will be used for internal
debugging purposes only.

Since the image is large, you could extract a single frame and upload just
that one. E.g. using libtiff from the CLI:
    tiffcp input.tif,1 output.tif

> I'm not very familiar with the new data structures, I'd prefer
> with staying with the ImageJ1 API for the moment.

That's what I would recommend, since the ImageJ2 data model is still
evolving.

Regards,
Curtis

On Thu, Jan 8, 2015 at 2: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.
>
> Could you please tell me, how to open such a file or how to convert an
> ImageJ2-Dataset to an ImagePlus?
>
> 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
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Open a big tiff file.

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by cri
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
cri
Reply | Threaded
Open this post in threaded view
|

Re: Open a big tiff file.

cri
This post was updated on .
Hi Wayne,

thanks for your reply.

Rasband, Wayne (NIH/NIMH) [E] wrote
You can open a tiff stack using

    img = IJ.openImage(path);

where ‘img' is an ImagePlus.
This opens the BigTiff image if I copy the created jar to the plugins folder of a full Fiji install. In this case I'm not able to debug my plugin with eclipse (using the methods described in the documentation).

When I use the method described in the documentation, IJ.openImage(path) return null for my images.

I also tried to compile imagej from source (so I could start it from the eclipse project, which would allow debugging), but I always get an "Plugin or class not found". (The same jar works in an full Fiji installation).

How would I debug a plugin which depends on other plugins?

Rasband, Wayne (NIH/NIMH) [E] wrote
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).
This will help me a lot, once I've dealt with the other issues.

Thanks,
Christian