Bfconvert : size of smallest pyramid level

I would like to create ome.tif files with pyramid resolution levels and use the following command (in version 6.5.1):

bfconvert -compression JPEG -tilex 256 -tiley 256 -pyramid-resolutions 6 -pyramid-scale 2 ORIGINAL.tif CONVERTED.ome.tif

For an image of size e.g. 2000x2000 pixel this create planes with
1: 2000x2000 pixel
2: 1000x1000 pixel
3: 500x500 pixel
4: 250x250 pixel
5: 125x125 pixel
6: 63x63 pixel

Is there a way to avoid creating planes with size smaller than the specified tile size (without manually pre-calculate the number of planes)?
If yes, how does it work?

If no, …
It would be nice to have an option to force bfconvert (aka ImageConverter) not to create planes smaller the ‘tilex’ / ‘tiley’.
The number of meaningful resolution levels is already defined by the image size, the specified pyramid-scale and the specified tile size in this case.

Currently the option ‘pyramid-resolutions’ seems to switch ON the sub-plane creation.
In the same way ‘pyramid-scale’ could be used as switch and in case the option ‘pyramid-resolutions’ is not specified bfconvert could calculate it automatically, like :

bfconvert -compression JPEG -tilex 256 -tiley 256 -pyramid-scale 2 ORIGINAL.tif CONVERTED.ome.tif

After some more tests the reason for the above post can be found here

Hi @phaub, currently the converter will require the -pyramid-resolutions number to be set in order to generate the requested number of resolutions. If there is enough demand for a feature to auto generate down to a sensible limit (such as tile size) then that perhaps is a feature request we could look into implementing in the future.

Hi @dgault, thanks for looking into this.

Yes, please have it on your list of future additions.

And when you are working on this, you can also look into the ‘not-so-nice’ error message when -pyramid-resolutions is set to high and bfconvert (ImageConverter) complains about not being able to produce tile with size of 0.
Exception in thread "main" java.lang.IllegalArgumentException: 0 must be non-null and strictly positive
It took me a while until I understood that this exception is created by a to high number of -pyramid-resolutions.

Good to know that using bfconvert to create OME-TIFFs with meaningful pyramid levels (with tile sizes >1, > 2; >3, …) means that I have to check first the image size and calculate the number of -pyramid-resolutions manually for each image separately.

Hopefully others who stumble over this issue will not get the wrong impression. And hopefully, if more users use bfconvert to create pyramid OME-TIFF files the demand to make the ImageConverter a bit more convinient will be higher.

Thanks for the feedback Peter, I have opened a new GitHub Issue with the feature requests mentioned here:

1 Like