Sai Chetan
Sai Chetan

Reputation: 41

cannot open tiff files compressed in this fashion (2) - imageJ/FIJI

I have two sets of images generated from MATLAB - one set is when I save manually from the figure window into a tif file and the other set has images saved in tif format by using imwrite function in MATLAB.

When I try to use the first set of images to perform some operations in Fiji (Image J) it works but when I try doing the same on the second set, I get an error saying 'cannot open tiff files compressed in this fashion (2)'. Is there a plugin that I need to install?

imfinfo for first set - created by saveas tif from figure window:

Filename: [1x68 char]
              FileModDate: [1x20 char]
                 FileSize: 51376
                   Format: 'tif'
            FormatVersion: []
                    Width: 719
                   Height: 477
                 BitDepth: 24
                ColorType: 'truecolor'
          FormatSignature: [1x4 double]
                ByteOrder: [1x13 char]
           NewSubFileType: 0
            BitsPerSample: [8 8 8]
              Compression: 'PackBits'
PhotometricInterpretation: 'RGB'
             StripOffsets: [69x1 double]
          SamplesPerPixel: 3
             RowsPerStrip: 7
          StripByteCounts: [69x1 double]
              XResolution: 96
              YResolution: 96
           ResolutionUnit: 'Inch'
                 Colormap: []
      PlanarConfiguration: 'Chunky'
                TileWidth: []
               TileLength: []
              TileOffsets: []
           TileByteCounts: []
              Orientation: 1
                FillOrder: 1
         GrayResponseUnit: 0.0100
           MaxSampleValue: [1x3 double]
           MinSampleValue: [0 0 0]
             Thresholding: 1
                   Offset: 50592
         ImageDescription: [1x22 char]

imfinfo for second set - created by imwrite. imwrite(bw,fullfile(filename),'tiff');

 Filename: [1x75 char]
              FileModDate: [1x20 char]
                 FileSize: 25586
                   Format: 'tif'
            FormatVersion: []
                    Width: 832
                   Height: 587
                 BitDepth: 1
                ColorType: [1x9 char]
          FormatSignature: [1x4 double]
                ByteOrder: [1x13 char]
           NewSubFileType: 0
            BitsPerSample: 1
              Compression: [1x8 char]
PhotometricInterpretation: [1x11 char]
             StripOffsets: [66x1 double]
          SamplesPerPixel: 1
             RowsPerStrip: 9
          StripByteCounts: [66x1 double]
              XResolution: 72
              YResolution: 72
           ResolutionUnit: 'Inch'
                 Colormap: []
      PlanarConfiguration: 'Chunky'
                TileWidth: []
               TileLength: []
              TileOffsets: []
           TileByteCounts: []
              Orientation: 1
                FillOrder: 1
         GrayResponseUnit: 0.0100
           MaxSampleValue: 1
           MinSampleValue: 0
             Thresholding: 1
                   Offset: 24868

Upvotes: 1

Views: 4303

Answers (2)

chans
chans

Reputation: 497

I am not sure, if you got the answer yet. I had a similar problem. Try saving your file via:

imwrite(bw,fullfile(filename),'tiff', 'Compression','none');

or try compression using 'packbits'

imwrite(bw,fullfile(filename),'tiff', 'Compression','packbits');

Upvotes: 1

yuk
yuk

Reputation: 19870

Try this plugin for ImageJ - IJ Plugins: Image I/O.


EDIT

It look like your image is binary (BitDepth=1). IMWRITE by default saves binary image in TIFF format with ccitt compression. Such images are not supported by IMageJ. (See, for example, this thread for a possible reason).

If you need to save your images with imwrite try to set BitDepth to 24 and Compression to packbits. Compare other fields in imfinfo outputs and use different ones in imwrite if necessary.

Upvotes: 0

Related Questions