Push data to annotation measurements in qupath

Hi Qupathers,
I would like to add details of how the annotations measurements were made into the annotation measurements. For example the time and date, the name of the script, and slide metadata. Help much appreciated as always :slight_smile: Alan

Hi Alan,

You can add a description to an annotation by selecting it, pressing Enter and writing your description down in the description text area.

I’m afraid adding this as an actual measurement is not quite possible, as you would need a timestamp format for the date and anyway wouldn’t really fit the purpose of object measurements.

Also, slide metadata sounds like it would be information about the whole slide image, rather than individual annotations. In such case, you can add a description to your project entry by selecting it, right click > Edit description.


Yep, and as part of a script, you can add a string to the description - in this case I added the current class to the description, but you could create a string that shows other information as well


That information is not exported. The only way I have found to export strings is to edit the name of the object. This will change the name to the class of the object plus the name of the image.

def name = GeneralTools.getNameWithoutExtension(getCurrentImageData().getServer().getMetadata().getName())
    it.setName(it.getPathClass().toString()+" "+name)

You can turn off these long names with the N key.

1 Like

Hi Melivin,
Thanks for this. I came across one of your posts Positive Cell Detection: How to get more data from it in the measurement exporter
This line works:

t = 20
getAnnotationObjects().getAt(0).getMeasurementList().putMeasurement(“DATA”, t)

Ideally I’d like to apply to all annotations rather than annotation objects…not sure how to achieve that?

Hi Alan,

If you want to put meaningful measurements in the measurementList of your objects (your detections + your annotations, which is I believe what you want to apply it on), you can do the following:

getAllObjects().each {
    it.getMeasurementList().putMeasurement("measurementName", 10.0)

Thanks Melvin, that works. :slight_smile:

1 Like