-
Notifications
You must be signed in to change notification settings - Fork 48
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
Unable to call VipsForeignSaveTiffFile #512
Comments
Hello @afriebel85, How many files are you stitching together? Windows has a hard limit of 2000 (I think). You might need to find a linux machine (or use WSL) if you are joining more than that. You might also be hitting stack size limits. You are doing: image = black(...)
for tile in many_tiles:
image = image.insert(tile, ...) So you are making a pipeline that's as deep as the number of tiles you are stitching. This will also fail for more than a few thousand tiles. You'd need to assemble in sections, then join with something like What are you doing with overlaps? You could do a feathered join, it might look nicer. As your code stands, I think you'll write a float OME TIFF. Do you need all that precision? You'd save a lot of disc and CPU with an 8-bit image. Other than that your code looks reasonable. I think I'd need to be able to run a copy here to understand what's going on in more detail. You'll need to make something you can send me that lets me reproduce the problem. |
I got 240 files that need to be stitched together. Each is 5580 x 4188 pixels and 8 color channels with image pyramid caluclated. There is no overlap between the tiles. The pixel precision of these tiles is float, which is what we got from the spectral unmixing software. During the stitching I downcast to ushort pixel type, to save disc space & CPU. I will try to generate a minimal example, without having you to download 160 GB.. :) |
Is this colour deconvolution, or something fancier? If it's just colour deconv, you can do that directly in pyvips and avoid a lot of processing. If your tiles are in a regular grid, you can use arrayjoin rather than insert in a loop. |
As far as I understand, the Akoya system captures the full fluorophore spectra, instead of only narrow bands, during imaging and then unmixes the different spectra, thereby greatly improving the SNR and isolating autofluorescence. I am not sure which exact method the Akoya software is using, but in general it can be achieved using algorithms like linear unmixing or non-negative matrix factorization. I'll do some further experimenting with the code I have and try to assemble a minimal failing example for sharing. |
Yes, that sounds like colour deconvolution. There's some sample pyvips code here: You just need to generalise to more than three channels, it should be easy. Maybe for another time! |
For my Akoya multiplex wholeslide sections I performed spectral unmixing with the Akoya InForm software which generated for a 8-channel scan 240 patches with float pixel precision resulting in a total of 166GB for this one scan.
I now want to stitch these patches back together, and downcast the pixel precision to ushort. I started with the very nice script from Ajay Zalavadia, used the first 8 pages as they represent the 8 channels at highest magnification (see below) and added the downcasting to ushort (after multiplication with 10) in the interleaved_tile method.
I tested the method on a smaller subset of 17 patches, and it took ~20min to complete. I checked the resulting ome.tif in QuPath and everything looked fine. I then tried to stitch the full set, however I got a crash after about 20 minutes:
I observed RAM usage, which shouldn't be a problem, it remains at ~3.5GB. Disk space isn't a problem as well with 1.3 TB available. I tried to diagnose the patches, in case there are faulty ones, but all can be read with tifffile and seem to have the exact same setup like so:
I am currently at a loss at what could cause this problem. What does the error message indicate?
The text was updated successfully, but these errors were encountered: