image.Data.getServer() - no longer working

I am trying to update some of my scripts from QuPath m2 to m5. I tried to run the following lines and was shown an error in m5.

// this script works as of 9/11/2019  - to be used on images which only have WM and GM lines drawn. This script will sample the areas and tile the greatest GM ROI

import qupath.lib.roi.LineROI
import qupath.lib.roi.PolygonROI
import qupath.lib.geom.Point2
import qupath.lib.objects.classes.PathClassFactory
import qupath.lib.objects.PathAnnotationObject
import qupath.lib.objects.classes.PathClass
import qupath.lib.gui.scripting.QPEx
import qupath.lib.common.ColorTools

def imageData = QPEx.getCurrentImageData()
def server = imageData.getServer()

t=server.getAveragedPixelSizeMicrons() //echelle pixel/micron

This is the error I was given:

If anyone could help to clarify what I need to modify in the script I would greatly appreciate it!


I would recommend taking a look at the changes listed on the blog (I keep forgetting to check there as well!).


def server = getCurrentServer()
def cal = server.getPixelCalibration()
print cal.getPixelWidthMicrons()
print cal.getPixelHeightMicrons()
print cal.getAveragedPixelSizeMicrons()