SaveAnnotationMeasurements -- Only save some groups/classes

Hello!

I am making a script for batch processing. I am analyzing some classes and others not (they however still need to be in the image). In the script I already have the line:
selectObjectsByclassification (“background”)’

By doing this, I only add my pixel classifier to this Class. However if I save my annotations with the following line:
saveAnnotationMeasurements()
All my other Class groups/annotations will also be in my file (without outcome measurements ofcourse). Is there a command/line where I can select only my “background” class to be saved?

I am not sure how to do this directly, but I can think of at least two indirect methods.
The first would be performing the saveAnnotationMeasurements after creating the background annotation, but before creating any other annotations, if possible.

Alternatively, remove the annotations that you do not want included prior to saving the measurements, and add them back in after.

Thanks for your reply!

The background annotation is actually made in my script. I extract some extreme pathology from my annotation, so I keep only the ‘background’ to classify further. The issue is that I cannot delete this first annotation, because I will still need it in other analyses. I will just delete the other annotations in my measurement files.

I’m not sure if I can ask another question here in this threat, but is there an option to save annotation measurement over all my images in one file, instead of one file per image?

That is what the Measurement Exporter is for, if you are using 0.2.0+.
https://qupath.readthedocs.io/en/latest/docs/tutorials/exporting_measurements.html

In older versions like 0.1.2, scripts were used to combine the exported files:

1 Like