TissueImageAnalytics / tiatoolbox

Computational Pathology Toolbox developed by TIA Centre, University of Warwick.
https://warwick.ac.uk/tia
Other
382 stars 79 forks source link

How to save images as TIFF files with metadata preserved #839

Closed ziyuanzhao2000 closed 3 months ago

ziyuanzhao2000 commented 3 months ago

Description

So I loaded a TIFF image with metadata using the WSIReader class and applied a color normalization method implemented by this toolbox, and then I want to save the image as a TIFF file. There doesn't seem to be a good way of doing this? I found utils.misc.imwrite() but it doesn't retain the metadata fields in the images that I loaded. Please let me know how should I deal with this. Thanks!

mostafajahanifar commented 3 months ago

Hi,

Thanks for raising this issue. Unfortunately, we do not support writing WSIs into TIFF. However, you should be able to easily do that using TIFFFile library (or other similar libraries): https://github.com/cgohlke/tifffile/