Add support for reading compressed NDPI tiles #4181
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This expands on the "precompressed" features added in #3992.
The main goal was to just add compressed tile reading to the NDPI reader, so that conversion from NDPI to DICOM wouldn't require much if any recompression. This required a variety of changes not limited to NDPI though:
JPEGTurboService
so that the repackaged compressed tiles can be retrieved, as well as the tile size and countsSVSReader
, and intoMinimalTiffReader
(to prevent duplicate logic inNDPIReader
)NDPIReader
to report optimal sizes based on actual IFD/JPEG stream, instead of constant 1024x1024DicomWriter
to allow different tile sizes in each resolution, since NDPI reports different sizes per resolutionNDPIReader
to use thesaveCompressedBytes
APIThe end result is that something like this should now work:
bfconvert -noflat -precompressed -compression JPEG CMU-1.ndpi cmu.dcm
and should complete within a few seconds as all tiles can be copied without any recompression.
I would not expect SVS -> DICOM support to change, but it probably makes sense to double-check just in case the refactoring caused any problems.
I don't expect this to fail tests, but excluding for now so this doesn't distract from 7.3.0. Given the API changes in
JPEGTurboService
, this probably does require a major version.cc @dclunie, @fedorov