-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for NDPI images >4GB #276
Conversation
Removed heuristic determination of 64 bit addresses. Added high bytes for restart markers.
Interesting! |
hiya - tried this with a 30gb ndpi and cannot get it work - same issue arises: openslide-write-png: ./largeslide.ndpi: Can't validate JPEG for directory 0: Expected marker at 21474841381, found none |
That's a big file, @AndyBlake . What's the resolution for that? What device did you use for scanning? (Just out of curiosity) |
@ntrahearn Hi, ntrahearn, Do you know how to use this PR on windows?, maybe you have windows version openslide of this PR. Look forward to your reply,thanks. |
In some newer NDPI files it seems that the tiff tag containing the higher bits of the restart markers is sometimes omitted if it isn't needed. So this adds an additional check for the presence of just the lower bit tag.
Works great on Ubuntu 22.04 LTS, makes working with files >4GB the same as smaller ones. |
@ntrahearn Thanks very much for tracking this down! Would you be willing to rebase your changes onto current Git Also, please certify to the Developer Certificate of Origin by adding signoffs to your commit messages. Even if you don't have time to rebase your changes onto |
Sure, I've made the changes and opened a fresh pull request here: |
Thanks! Closing in favor of your updated PR #602. |
Addresses issue #174 (and possibly others), regarding the reading of large NDPI files. This issue stems from the fact that classical TIFF (and by extension, NDPI) images only support up to 32 bit values for tagged metadata. However, due to the nature of whole slide image data, it isn't uncommon for the size of an NDPI to exceed the 32 bit range. This means that key metadata, such as the byte positions of image layers or their size in bytes, may be too large to store in a traditional TIFF IFD entry.
Currently OpenSlide relies on heuristics to determine the high bits of 64 bit addresses, which fail in some cases. However, this is unnecessary, as NDPI actually stores the high bits of the offset/value of each tag in 4 byte blocks immediately after the end of the IFD.
This fix modifies openslide-decode-tifflike.c to append these extra 4 bytes to each IFD entry's value/offset and, if necessary, modifies its type to LONG8.
This fix also modifies openslide-vendor-hamamatsu.c to construct correct restart marker addresses. Currently only the values in TIFF tag 65426 are used, which are only the lower 32 bits of each address. High bits are stored in TIFF tag 65432, so these are now appended before mcu_starts are calculated