Transform and Copy for TMA Grid

Hi Everyone,

I know that Pete has a script for copying the annotations and detections from one image to others based on transform factor of Interactive Image Alignment feature.

Is there any way to copy a TMA grid by using the transform factor to other images in the same way?

Thanks!

We are doing staining and staining removal cycles on the same slide and my purpose is using same exact TMA grid for the same slide stained with multiple markers and then export all the cores as ome.tiff files.
After exporting I’ll do Fiji SIFT registration, color deconvolution with H-AEC, color inversion for IHC channels, channel merging and ultimately having pseudoflourescence multiplex images for each core and analyze them.
I need the numbering power of TMA grid, though…

If I can convert TMA grid to multiple annotations for each core with the same numbering system, I will be able to use Pete’s transform and copy script and it would work as well.

This script should create annotations using the same ROIs and names as the TMA cores, clear any objects and then add the annotations.

def annotations = getTMACoreList().collect {
    def annotation = new qupath.lib.objects.PathAnnotationObject(it.getROI())
    annotation.setName(it.getName())
    return annotation
}
clearAllObjects()
addObjects(annotations)
fireHierarchyUpdate()

It works like a charm.

Thank you very much, appreciated!

Guray

One last question?

Is there any way to export these annotations as OME.TIFF images with that TMA grid numbering system altogether?

It would be possible, but require more time to write the script than I have got at the moment (but maybe someone else can). This discussion could help.

saveAs(“tif”, “/Users/…/Desktop/Export/” + getTitle())

Sending annotations with batch process to imageJ by using ImageJ macro runner and save them in a folder makes sense, however when an annotation is sent to ImageJ, it gets the image title not the annotation label itself. As a result; The macro above overwrites the saved annotations 250 times for 250 annotations in an image.

If there is a way to send the annotations to ImageJ with annotation name, it would be very easy to save them in batch mode.

For any annotation you can use .getName() like in the macro in Pete’s post, and add that into the file name for that particular export. If you are running this through an ImageJ macro, you will need to pass that string into the ImageJ macro.

The Complex Scripts section of the Gist has a few more examples of passing many variables into ImageJ macro strings.

Image Export, by annotation name, through ImageJ macro found here.