amspath / libisyntax

BSD 2-Clause "Simplified" License
12 stars 7 forks source link

isyntax-to-tiff features #36

Open jonasteuwen opened 8 months ago

jonasteuwen commented 8 months ago

The following features would be useful in the isyntax-to-tiff

The first is self-explanatory; the second would mean that we create the pyramid ourselves from the tiff. Right now I'm using isyntax-to-tiff and subsequently use libvips to create dense pyramid. This solves the misalignment issue.

However, the downsampling is not really trivial, if we feel this is a good feature, does anyone have a suggestion for a lightweight downsample library (probably uses anti-aliasing too, I will check the libvips code). EDIT: EDIT: Vips seems to be using the 'mean' operator: https://github.com/libvips/libvips/blob/159e8bea25fbc70316e32cd36add0b7c899568b7/libvips/foreign/tiffsave.c#L424C24-L424C47 that should be fine with stb_image.h

Would this be of interest? I can create it.

Falcury commented 8 months ago

I think this would be a great addition. My first thought also was to check how libvips does it, and try to do it that way.

The implementation of the mean shrink operator seems to be here: https://github.com/libvips/libvips/blob/master/libvips/iofuncs/region.c#L1190

And here: https://github.com/libvips/libvips/blob/master/libvips/iofuncs/region.c#L1149

I'm kind of surprised they don't use SIMD!

jonasteuwen commented 5 months ago

I've been playing around a bit with the 2x2 reduce operator (averaging), which seems to give good images (also to pathologists). That shouldn't be too hard to implement.