SelectAnnotations by size in QuPath m4 Version


in former QuPath version it was possible to select annotations by size with the following script from Pete:

def server = getCurrentImageData().getServer()
double pixelWidth = server.getPixelWidthMicrons()
double pixelHeight = server.getPixelHeightMicrons()
def smallAnnotations = getAnnotationObjects().findAll {it.getROI().getArea() < 4}
removeObjects(smallAnnotations, true)

This Script throws the following error:
ERROR: Error at line 6: No signature of method: qupath.lib.images.servers.openslide.OpenslideImageServer.getPixelWidthMicrons() is applicable for argument types: () values:

The image was opened with OpenSlide (the visualization fails with bioformats).
Does somebody have an idea how to adress annotations by size in the new QuPath version in images opened with OpenSlide ?

best, and thanks for any respons!

The pixel sizes have moved a little deeper, and are now accessed via a ‘PixelCalibration’ object. There is an explanation of how to use it at

The reason is to help support pixel calibrations that in the future may not be in microns without requiring many more methods being added to the ‘ImageServer’ itself.

1 Like

thank you Pete. I did not find a solution and went back to 0.12.


double pixelWidth = server.getPixelWidthMicrons()
double pixelHeight = server.getPixelHeightMicrons()


double pixelWidth = server.getPixelCalibration().getPixelWidthMicrons()
double pixelHeight = server.getPixelCalibration().getPixelHeightMicrons()

uh that easy :slight_smile:
thanks a lot. This helped immeadetly to repair some other scripts as well!