-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Importing/Pregeneration Annotations.. #61
Comments
This is certainly possible. The easiest way to start would be to write a Groovy script for the import, although you could also create a Java extension if needed. The latter would require more code, but could incorporate extra user-friendliness (e.g. a menu item, drag-and-drop support). For each boundary, the process would be something like this:
Most code for specific ROIs is here - so you could create rectangles, ellipses or lines if required, or just stick with PolygonROI for polygons. The most useful constructor is: public PolygonROI(float[] x, float[] y, int c, int z, int t) For After creating your polygon ROI, then create a public PathAnnotationObject(ROI pathROI) and finally you can add this annotation to the hierarchy simply with addObject(annotation) I have some memory of Aperio ImageScope having a concept of layers, and also 'negative' regions; I don't know if this would also be in your XML. If so, these may not have exact matches inside QuPath, but there are various tricks you could use if you find they are needed (e.g. combining or subtracting ROIs, adding them to the hierarchy in different ways, setting names, classifications or colors etc.). If you haven't already, I suggest checking out the Wiki for Writing custom scripts and Advanced scripting with IntelliJ, which can help with writing the code and accessing the QuPath source. Finally, it may also be useful to know that, if you want to use any other Java libraries to help, then you can drag the required Jar file onto QuPath to copy it into QuPath's extensions directory. Even if the Jar isn't a 'real' QuPath extension, this means that it will still be available on QuPath's classpath when running the script. This could be useful if your XML parsing code is already contained in a Jar, or if you want to add another library (e.g. Hopefully that helps to get started. |
Just in case anyone still needs this I put up a gist of a script I wrote to go directly from Aperio to QuPath: https://gist.github.com/DanaCase/9cfc23912fee48e437af03f97763d78e |
qupath#455 qupath#238 qupath#61 In the end, just easier to add it. Also, XmlUtil.serialize(String) makes pretty-printing straightforward.
Hey @dgutman can you share the code on how to parse those XML files for annotations, actually I have an XML file for the .scn digital histopathology image and one of those XML files has 4 vertices for a region while another XML file has 2 vertices for a region and I am baffled on how to work with them, |
Hey everyone I was working with .xml files of image scope for annotation of .scn WSIs and I want to parse those XML files so that they can be later converted into MS COCO .json annotation format with boxes. |
We have a lot of annotations previously done using Aperio ScanScope which generate the XML files. We already have code that can parse those files and get out the boundaries for the various objects/layers....
We'd like to be able to compare analysis results done using QuPath with those we previously did in ScanScope, without having to redraw the annotations ...
If we had the boundaries of the shapes (lets just assume polygons for general use case), would it be possible to somehow import them and create an annotation layer we could use for analysis?
The text was updated successfully, but these errors were encountered: