picasso
picasso copied to clipboard
Wishlist: support for zlib compression in Tiff files
- 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.
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):
Example image of compressed file:
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.
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.