John-P / wsic

Whole Slide image (WSI) conversion for brightfield histology images
MIT License
33 stars 4 forks source link

Trying to create the thumbnail of a converted tiff image times out #5

Closed ghadjigeorghiou closed 2 years ago

ghadjigeorghiou commented 2 years ago

Description

I used the wsic tool to convert a jp2 image to tiff. This was a test because I want to use the tool to convert multiple images and upload them to WASABI and the PathLAKE Portal. However, I've noticed that the testing image was not displayed on WASABI. I tried to investigate the issue by reading the image locally and then found out that I was not able to create the thumbnail because it was timing out (taking more than 10misn before crashing). There were no error logs during the conversion of the image, so I expect that it was successful. Also, I managed to convert the image using another tool, therefore the original image is not corrupted and not causing this issue.

I have included all the commands that I have used below. I have also uploaded the original and converted image to OneDrive here. @John-P you should be able to access these images. If you can't please let me know.

What I Did

Command that I used to convert the jp2 image to tiff

wsic convert -i /input/path/image.jp2 -o /output/path/image.tiff -rt 4096 4096 -c jpeg -w 10 --no-ome --overwrite -to 60

Command that I used to read the image using tiatoolbox (Works fine and runs in 0.1s)

wsi = OpenSlideWSIReader(
                input_img='/input/path/to/image.tiff')

wsi_info = wsi.info.as_dict()
# Print one item per line
print(*list(wsi_info.items()), sep='\n')

Command that I used to create and display the thumbnail of the image using tiatoolbox (Times out)

wsi_thumb = wsi.slide_thumbnail()
plt.imshow(wsi_thumb)
plt.axis('off')
plt.show()

Command that I used to read the image using OpenSlide directly (Works fine and runs in 0.1s)

openslide_wsi = openslide.OpenSlide(filename='/input/path/to/image.tiff')

Command that I used to create and display the thumbnail of the image using OpenSlide (Times out)

openslide_thumb = openslide_wsi.get_thumbnail(size=(256, 256))
plt.imshow(openslide_thumb)
plt.axis('off')
plt.show()

note: I think this might be the reason why the image cannot be displayed on WASABI. Link to WASABI collection with the converted images: here. @John-P I have given permissions to your wasabi user for this collection. Let me know if it doesn't work.

John-P commented 2 years ago

Looking into this. In the meantime, the linked PR on generating thumbnails from the CLI may be of interest

ghadjigeorghiou commented 2 years ago

Hi @John-P, I think this is fixed by creating an image as a pyramid (using the downsample option in the cli) instead of a flat one. Feel free to close the issue.