QuPath tiled export leads to seemingly corrupt jpeg in Fiji

I previously enquired about the proper way to export a whole slide image that was too large to fit in a 2^31 Java array (Qupath unable to write image. The solution was to used the Tile exporter, which I did. However, there is something mysterious about the resulting tiles. When they are zoomed to fit inside a window in Fiji, there is some noticeable corruption of the image data at the bottom edge. However, it disappears when I zoom in, but only if the magnification is increased to 100 % of the original image size or beyond.

I made a gif that shows the problem in action.
corruption

If I open the jpeg in the standard Windows 10 photo viewing app, then the corruption is not present (and the image looks a lot less grainy at low magnification, e.g. about 4 % as shown in screenshot below) compared to the same magnification in Fiji. So what gives? Should I be worried or can I just assume all is peachy?

I’m not sure the title of this topic is justified – it sounds to me more an issue with ImageJ/Fiji’s display rather than that the JPEG is corrupt, since it displays correctly at 100% magnification or when viewed in the Windows viewer. But it is difficult to say without having such an image.

The difference in graininess is to be expected if different smoothing/interpolation algorithms are used by different software when viewing at a lower resolution.

Does this cause you any problems?

Forgive me, I was merely trying to convey the order of events. I suppose I could have reworded it to place Fiji in the front.

I’m not sure how I would go about inspecting the image on my own, but I would be more than happy to share the image in question, if you have some ideas that you want to test out. If no special software is required, I can also do it myself, if you point me in the right direction :slight_smile:

That makes sense, I guess I was just so focused on the corrupt data that I thought it was yet another sign.

I don’t know yet. I wanted to be proactive and not risk wasting days on analyzing corrupt data.

No worries, but if it’s not a QuPath problem then it’s less likely to get the attention of people who can help.

Some ideas:

  • Try opening the image in more software applications (including QuPath, perhaps Python if you’re using it)
  • Try opening using the Bio-Formats importer rather than ImageJ’s default reader (checking for any logged errors)
  • Try JPEGs of a similar size written by other software, opened in Fiji
  • Try different JPEGs written by QuPath of a similar size, opened in Fiji
  • Try PNGs / TIFFs written by QuPath of a similar size, opened in Fiji

Sure, but similarly I don’t want to waste hours trying to get to the bottom of an issue that isn’t in QuPath and isn’t actually causing anyone any issues :slight_smile: Do keep in mind that the time of the folks who provide free help on the forum is valuable too – doing as much as possible to make your questions fast and straightforward to answer helps a lot. This sounds like purely an ImageJ visualization issue, but I don’t know your downstream workflow so really can’t assess if there is any risk.

1 Like

So I’ve verified that the problem is Fiji rendering errors. I created a jpeg in GIMP with the exact same dimensions and it had the same kind of corruption along the bottom edge. Similarly GIMP opens the jpeg from QuPath fine. I guess it’s mostly a cosmetic error for Fiji, but maybe it is worth looking into at some point down the line. I’ll leave that decision to the main devs :slight_smile: Thanks for your help and suggestions :+1:

1 Like

I can confirm the lower rows are wrong when I open a large RGB image (23048 x 23048 pixels, extracted from CMU-1.svs) in both ImageJ and Fiji, and view it zoomed out:

Interestingly, it happens with TIFF as well – and the ‘wrongness’ varies when I open the image multiple times.

However, the actual bug appears to be in Java. If I launch the same version of ImageJ with Java 16, it works fine. It also works fine when using the ImageJ bundled within QuPath – which is using a more recent Java version as well.

This suggests there’s nothing really wrong in ImageJ, Fiji, QuPath or the JPEG – but at some point the problem of downsampling large images has been addressed in the JDK.

2 Likes