Bayer-Group / tiffslide

TiffSlide - cloud native openslide-python replacement based on tifffile
Other
86 stars 12 forks source link

ICC color profile - SVS aperio GT450 #11

Open delta2golf opened 3 years ago

delta2golf commented 3 years ago

Thank you again for the hard work on this. There is a discrepancy between the colors of the images extracted and the optimal colors such as the one seen in Leica Imagescope. Are you able to incorporate ICC profile or other solution to address this color issue? This issue is similar to what I described in this post. Thank you so much! https://forum.image.sc/t/color-discrepancy-qupath-x-imagescope-leica-gt450/57948/5

delta2golf commented 3 years ago

https://github.com/openslide/openslide/issues/139

ap-- commented 3 years ago

Hi @delta2golf,

interesting suggestion. I thought about this a bit and I think we could add this to tiffslide itself. Getting the color profile seems super easy:

import io
from PIL.ImageCms import ImageCmsProfile
import tiffslide

t = tiffslide.TiffSlide("/path/to/your/image.svs")
try:
    icc_profile_bytes = t.ts_tifffile.pages[0].tags[34675].value
except KeyError:
    raise Exception("no icc profile stored in image")

icc_profile = ImageCmsProfile(io.BytesIO(icc_profile_bytes))

Then we'd need to build the output transform and apply it in-place to the returned PIL Images.

We'd need to test how much this slow's everything down. But we could emit a warning if the user wants to apply an icc profile.

Would you be interested in contributing this as a Pull Request? If yes, I can sketch out the interface and you could work on the implementation.

Cheers, Andreas 😃

tomvars commented 2 years ago

Hi, is there any update on this? Also interested in this feature 👍

ap-- commented 2 years ago

Hello @tomvars

I assume there has not been any progress on color profile support so far. Contributions are always welcome ❤️ And as stated above, I'd be happy to provide some initial guidance on the implementation if needed.

Cheers, Andreas 😃

ap-- commented 2 years ago
ap-- commented 9 months ago

ICC profiles are now available thanks to #83 @erikogabrielsson

Will be available in the next release.