Qupath: add pyramidal tiff into image list

Hi,
recently I’ve encountered an issue to add ptif into image list of a project (v0.1.2)
(1) In general, it appears that all levels are loaded, with format FILE_NAME #level.
(2) It appears that Qupath still intends to load the level with highest resolution into the java.awt.Rectangle, which triggers the exception like below:

INFO: TiffDelegateReader initializing E:\pyramidal.tif
INFO: Reading IFDs
INFO: Populating metadata
INFO: Checking comment style
INFO: Populating OME metadata
INFO: No memoization file generated for E:\pyramidal.tif
WARN: Unable to parse magnification: null
INFO: Returning server: Bio-Formats for E:\pyramidal.tif
INFO: TiffDelegateReader initializing E:\pyramidal.tif
INFO: Reading IFDs
INFO: Populating metadata
INFO: Checking comment style
INFO: Populating OME metadata
ERROR: Error opening image 0 for region java.awt.Rectangle[x=0,y=0,width=25655,height=28079].

(3) For files within the size limit, they can be correctly loaded by bioformats by using “open”.

(4) The tile-size is 256x256 in the pyramid. (Converted by ImageMagick).
May I ask if there is any workaround? Thanks.

From the log it appears that QuPath is using Bio-Formats, and the pyramid levels are not being identified as sub-resolutions of the same image. I’ve added the Bio-Formats tag to this post in case it helps get the attention of the Bio-Formats team…

You may also wish to try the latest QuPath milestone (v0.2.0-m2) to see if the issue has already been resolved there… although since the milestones still have some way to go before a proper release, I would recommend sticking with v0.1.2 in general for stability.

Thanks Pete. May I ask if there is a way to export images to be virtual slide formats (e.g. svs/ndpi)? In this case perhaps the Qupath can load them by OpenSlide and the problem may be resolved.

You might have more luck with VIPS, but I don’t know: https://github.com/openslide/openslide/wiki/CreatingPyramidalTIFFs

The issue in v0.1.2 might be that QuPath is unduly strict when using OpenSlide about pixel sizes being available in microns… and this prevents your current image from working. I should have fixed that now, and it’s the only reason I can think of why it might have a chance of working in the milestone version but not v0.1.2.

There are also some discussions on how Bio-Formats ≥ 6.0.0 could be used for the conversion: Ome.tif (multi-channel, tiled, pyramid) from individual large tiff raw files

(I’ve recently been investigating how to write OME-TIFF pyramid more efficiently and easily through QuPath… but that code isn’t yet in any release of any kind. Soon…)

@CielAl it might be useful to know more about which file format you are using. Is your ptif created by VIPS or ImageMagick according to the specification described in https://iipimage.sourceforge.io/documentation/images/?

If so, it is correct Bio-Formats currently does not support this format generically at the moment although note the ongoing discussion in https://github.com/openmicroscopy/bioformats/issues/3300. OpenSlide should have some support for this format as the so-called Generic Tiled TIFF format.

Hi. Thanks for the reply.

I convert the source image to the ptif by the ImageMagick following the instruction in https://iipimage.sourceforge.io/documentation/images/. However, it appears that OpenSlide cannot load the output tif as well (unsupported format).

I can get Openslide in QuPath to open ptfis generated through imageMagick or VIPS as long as they are 24-bit RGB images. If your images aren’t 24-bit RGB you can pyramidalize them with bio-formats bfconvert cmd line tool to ome.tiff and bio-formats reads these well in QuPath in both 0.1.2 and 0.2.0-m2. For ome.tiff, make sure the raw tiff data is saved with “little” endianness (you can do this in ImageJ) otherwise the conversion will be very very slow.

2 Likes