How do I send my annotated QuPath files to another QuPath user? (the easiest way)

Hi,
I want to share /send my annotated files to another qupath user, but I don’t understand how to do it.
I don’t know how to make a script, I just want to find the button that says send the file to an e-mail adress…
Thanks !

Hi @elisyn,

You can export your annotations like this:

def annotations = getAnnotationObjects()
boolean prettyPrint = true
def gson = GsonTools.getInstance(prettyPrint)

def path = "path/to/your/file.json"
def file = new File(path)
file.write(gson.toJson(annotations))

print "Done!"

and then import them back like this:

import qupath.lib.io.GsonTools


// Instantiate tools
def gson=GsonTools.getInstance(true);

// Prepare template
def type = new com.google.gson.reflect.TypeToken<List<qupath.lib.objects.PathObject>>() {}.getType();
def json_fp = promptForFile(null)

// Deserialize
deserializedAnnotations = gson.fromJson(json_fp.getText('UTF-8'), type);

// Add to image
addObjects(deserializedAnnotations);

// Resolve hierarchy
resolveHierarchy()

print "Done!"
1 Like

If you’ve used a project, you could just send them the project folder (perhaps as a zip file if it helps for email).

1 Like

I did now, thanks a lot :smiley:
Btw; does it matter if I have made the annotations in an older version of QP, will the recipient still be able to work/edit /do something with the images in the latest version?

It should generally be possible to open annotations in a newer version if they were created in an older version. For projects, there’s a special import command for to bring v0.1.2 projects into v0.2.

The opposite doesn’t necessarily work (opening in an older version).

You might occasionally have trouble for especially complex annotations, but this should be rare and hopefully won’t cause any trouble.

1 Like

Hi again, I’m so confused :confused:
As I understand, the image folder and the QuPath project folder are 2 different things. The annotations lie within the project folder, and “the naked image” itself is in the image folder?

If one QP user sends a project to another QP user, I understand she must also send the image folder. But if the recipient has the same images stored in his own files somewhere, then he should be able to open the project folder that he receives from his colleague and use the images that he already has. The annotations made by his colleague should then be “put on top” of these images?

So when you receive a project folder and you already have the images, you need to change the URI adress of the images so that you can open them in the project . How do you tell QuPah to change the URI adress of the image files? I get this message saying “Unable to build Image Server for file XX …” (but the table that pops up that allows me to change the URI adress goes away after one change, and I have many images that need a new file adress… )

Forgive med my complete lack of technical insight :flushed:

When you receive the project, it should be a folder that contains a project.qpproj file inside it.

Open this, and you can follow the instructions here: https://qupath.readthedocs.io/en/latest/docs/tutorials/projects.html#fix-paths

In particular, the Search button helps with changing multiple URIs at once.

1 Like