Copy ROI to new slide does not show up

Hi all,

I would like to thank Pete for all the effort put into Qupath! It is a wonderful program.
I am trying to copy ROI’s (annotations) in Qupath from one slide to the other.
I used shift+E or the code underneath.
However, the annotations only show up sometimes. I have put the slider to maximum visibility and enabled the show all annotations button. Does this have to do with the location of the tissue on the slide or different resolutions?

Thank you in advance!
Kind regards,
Tom

def path = buildFilePath(PROJECT_BASE_DIR, ‘annotations’)

def annotations = getAnnotationObjects()

new File(path).withObjectOutputStream {

it.writeObject(annotations)

}

print ‘Done!’

def path = buildFilePath(PROJECT_BASE_DIR, ‘annotations’)

def annotations = null

new File(path).withObjectInputStream {

annotations = it.readObject()

}

addObjects(annotations)

print 'Added ’ + annotations

Thanks Tom! Generally I use Shift + E to copy between two viewers. I select the viewer with the ‘active’ annotation, then click one inside the other viewer, then press Shift + E. If you try that and find that sometimes it doesn’t work… me too, but if I click between the viewers (to active one then the other again) it generally does come alive.

The need to toggle between viewers is a bug, but because it always ‘works in the end’ (for me at least) it hasn’t bothered me too much yet and I haven’t explored the reason. I also tentatively plan adding a new command to transfer annotations between images that should give more control (potentially at the expense of an extra few clicks).

The image size could matter because the ROI is transferred using pixel coordinates, with the origin at the top left. So potentially a transferred annotation might ‘not fit’ in the new image.

Thank you Pete for your quick response! This indeed works most of the time. I think indeed sometimes the annotation does not fit. When I have comparable slides (location/size of the image) it seems to work better.