Annotations displaced when opening saved qpdata file

I annotated some tissue regions on qupath and saved the files as a qpdata file. Now when I open those same saved files on qupath all of my annotations are displaced and no longer correpond to the tissue section. Has anyone had this problem or knows how to fix it? It took me hours to make annotations and now they are all gone!

Could you explain how exactly you are handling your files? It does not sound like you are running things in a project. Those annotations do not look like they match up with that particular image.

In addition, you might be interested in using the pixel classifier or thresholder to generate tissue level annotations automatically (and you can tune or adjust them as needed later).
Pixel classifier

Yes, I think I am able to more accurately descibe the problem now. I was analyzing .czi files that had multiple scenes, when I opened the file qupath would ask me to select a scene. I believe that my annotations saved to the first scene in the file (scene #0) as opposed to the scene which I applied the annotation to when I opened said file. My qpdata file with annotations for scene #0 always hold. I’m very new to qupath and so don’t really know the best way to save data when dealing with scenes.

1 Like

There are several different format types that are handled “best” only when opened within a project. Most of those are multi-image formats like you are describing. I am not sure if you would need to start over, but I strongly recommend starting a project.

If you can find the correct entries, and it is important enough, you can probably swap a .qpdata file saved outside a project with one that is inside the project. I would recommend giving the more automated ways of tracing tissue outlines a try first, though. You can then apply them to a whole project’s worth of images.

I have another, similar guide here for tissue detection.

Thanks so much for all your help! I’ll be creating a project and adding my images to that. I was using simple tissue detection to create annotations, but I cannot figure out how to apply that to an entire project.

1 Like

The same way as for the pixel classifier or thresholder. Workflow tab, Create script, copy the appropriate line into a new script, Run->Run for project… within the Script Editor window.

The workflow tab is similar to the Record macro feature in FIJI, if you are familiar with that. Though running a particular thing for a whole project is much easier in QuPath, as long as you have the project.

I really have no experience with prior tissue analysis. How do you find the appropriate line for a new script?

If the last thing you ran was the simple tissue detection, it would be the last line, similar if you created objects using the thresholder. There is an example of what that line might look like in the adventure:

Simple tissue detection would probably have simple tissue detection written somewhere in it.

Great, so I now have the line I need to run.

runPlugin(‘qupath.imagej.detect.tissue.SimpleTissueDetection2’, ‘{“threshold”: 127, “requestedPixelSizeMicrons”: 20.0, “minAreaMicrons”: 10000.0, “maxHoleAreaMicrons”: 1000000.0, “darkBackground”: false, “smoothImage”: true, “medianCleanup”: true, “dilateBoundaries”: false, “smoothCoordinates”: true, “excludeOnBoundary”: false, “singleAnnotation”: true}’);

I believe that I have created a script.

I then clicked Run --> Run for project, but it didn’t apply it to any of my images/scenes. Sorry to bother you with this, but I really have no idea how to do it.

That looks right in essence, but I am guessing that simple tissue detection is not finding anything. A threshold of 127 is VERY low, I would generally expect something like 180-200 to produce better results on most images.

The line needs to be the same simple tissue detection that worked on your current image (usually the last/bottom/most recent one, but not always).

It is also best to use the code formatting for scripts
Otherwise they cannot be copied and pasted back into QuPath easily.

Just to confirm: did you move all the images from the ‘Available’ to ‘Selected’ column in the Run for project dialog?

With regard to losing track of a .czi “scene”, it may be reasonable to consider splitting out the scenes into individual files as part of the workflow if there is no reason to keep them together in one virtual slide file (granted the czi offers the global view and the label image so there are important bits to keep). For straight up manual annotation of structures, we have had good luck working on a selected scene separated into a single image. This allows us to export the resulting SVG annotations and they will line up in downstream web presentations of the data. It depends on the end result desired and the workflow you need.