picasso icon indicating copy to clipboard operation
picasso copied to clipboard

Wishlist: support for zlib compression in Tiff files

Open ajasja opened this issue 2 years ago • 2 comments

  • Picasso version: 0.4
  • Python version: 3.8.5
  • Operating System: Win10

Description

Trying to load a tiff with zlib compression. In my particular case there is a huge size difference between compressed and uncompressed. image

What I Did

The file was written with and can be opened in imageJ.

tifffile.imwrite('test.zlib.ome.tif', out , ome=True, dtype=np.uint8, 
    photometric='minisblack', metadata={'axes': 'TYX'}, compression='zlib')

Tifffile (https://github.com/cgohlke/tifffile) could be used to load the tiff file.

Example image (no compression): image

Example image of compressed file: image

ajasja avatar May 06 '22 11:05 ajasja

Hi Ajasja, I took a close look at the issue you reported and here are some of my conclusions:

  • I am not sure if you let zlib compression for a long enough time. I also observed that immediately after calling tifffile.imwrite a new file was created of a very small size but the function did not finish running. After a few seconds/minutes, the compressed file was updated and the different in sizes of the compressed and uncompressed files was no longer so drastic. However, I tried compressing a tiff file of size around 4GB so this may not apply in your case.
  • Unfortunately, after the compression was finished, I also saw the noisy image you posted above. I will try to take a closer look at compressing image files and to include reading them in Localize.

rafalkowalewski1 avatar Jun 14 '22 17:06 rafalkowalewski1

Thanks! @rafalkowalewski1 . In my case I think the difference in size is due to most of the image being set to 0, so it's easy to compress. It is of curse also possible that I did not wait long enough for the size to update.

ajasja avatar Jun 16 '22 08:06 ajasja