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.
Does this PR close any open issues?
Closes #112.
Give a longer description of what this PR addresses and why it's needed
This code adds support for Zstd decompression. Zstd compression is the preferred algorithm used by our collaborators. It is not supported out of the box by viv's
loadOmeTiff
function. Fortunately you can register new ways to decode the data. This is largely done withgeotiff
which is a library used by viv.Since we are using worker threads to do the decompression (this fixed many issues in the past) by passing a
Pool
object to theloadOmeTiff
we have to do a little extra work in order to add the new decoder to a worker.First, we have to create a new worker in decoder.worker.ts that is set up to handle Zstd by adding the the decoder for it. This is done with the addDecoder function. The 50,000 is the identifier for Zstd (see http://fileformats.archiveteam.org/wiki/TIFF).
Since this is the first custom worker we are writing, this also caused some build issues. To resolve these I had to update
vite.config.ts
to fix the issue referenced here (vitejs/vite#17483). This introduced another error that required updating vite from 4 → 5 (see vitejs/vite#17775).