Skip to content

Conversation

@mapinis
Copy link

@mapinis mapinis commented Apr 13, 2025

Hello!

In my work with GrandQC (specifically with SVSs and on Mac), I noticed that wsi_tis_detect.py would sometimes save the tissue detection mask with mode I;16. This image is then loaded in main.py and a resize is attempted with resample filter LANCZOS on line 143:

tis_det_map_mpp = np.array(tis_det_map.resize((int(w_l0 * mpp / MPP_MODEL), int(h_l0 * mpp / MPP_MODEL)), Image.Resampling.LANCZOS))

This would cause an error:

There was some problem with the slide. The error is: image has wrong mode

This is because of a known issue with Pillow 10.4.0 not supporting all resampling filters for images of mode I;16: python-pillow/Pillow#8333.

This has been patched in Pillow 11.0.0 and higher: python-pillow/Pillow#8422

In my testing this resolves the issue on both my Mac and on an Ubuntu VM with CUDA, but please try it on your systems!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant