glencoesoftware / bioformats2raw

Bio-Formats image file format to raw format converter
GNU General Public License v2.0
77 stars 35 forks source link

Downscale factor option #193

Closed will-moore closed 1 year ago

will-moore commented 1 year ago

See discussion at https://github.com/broadinstitute/lincs-cell-painting/issues/54#issuecomment-1439980471

In order to save on disk space, but still provide low-resolution pyramid levels (for thumbnails) there is a use-case for the down-sampling factor to be a custom value higher than 2.

E.g. with images of 2160 x 2160 in that example, we might want to create a single downsampling resolution by a factor of 16 to give 135 x 135 thumbnails.

Currently looking at a python script to add a thumbnail resolution to an existing NGFF after conversion, but the ability to generate this during conversion would be much preferred.

melissalinkert commented 1 year ago

In this use case, is the goal to have just the full resolution image(s) and a set of thumbnails? So just 2 resolutions regardless of the input image size?

will-moore commented 1 year ago

Yes, 2 resolutions in this case. But I think that in other cases you may just want more resolutions with e.g. a factor of 4 that still gives you a space saving compared with factor of 2. It seems like you can achieve various outcomes with a combination of downscale factor and --resolutions or --target-min-size.

melissalinkert commented 1 year ago

Closing, as I don’t think we want to support arbitrary downsampling values in general. For relatively small 2160x2160 images, I understand this saves at most 1.2MB per plane (less if blosc compression is used). In this case, though, the number of generated resolutions makes very little difference in terms of visualization in OMERO.

For the more common whole slide imaging use case, the downsampling factor/resolution count makes a big difference in the visualization experience. I’d really prefer not to make it easy to change the downsampling factor for this case, as it would be very easy for an inexperienced user to create data that performs quite poorly in OMERO.

My understanding is that there is already a working solution to create plate thumbnails; another option would be to post-process the output of bioformats2raw to remove selected resolutions.