Skip to content
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

Create annotations API #118

Open
boskar opened this issue Jun 29, 2013 · 5 comments
Open

Create annotations API #118

boskar opened this issue Jun 29, 2013 · 5 comments
Labels
api Requires API changes enhancement

Comments

@boskar
Copy link

boskar commented Jun 29, 2013

Athough It's not a key feature some API for annotations should be defined.

Probably most formats openslide supports have the possibility to store some metadata. It might be difficult to unify different approaches of vendors, but on the other hand - it should be simplier to implement work them out. It shouldn't require so much reverse-engineering, as even in MRXS annotations are stored in xml-alike format.

In MRXS case Data0023.dat after stripping first 296 bytes is pure xml with pretty obvious content.

@bgilbert
Copy link
Member

Discussion of the NDPI annotation sidecar format.

@boskar
Copy link
Author

boskar commented May 1, 2016

OK, I would like to start the work.
After a few years of working on mrxs, iipsrv and openseadragon stack I would like to propose a solution, and, hopefully, some code.

In my opinion the best format for annotations is svg.
Why?

  1. Directly rendered by web browsers
  2. Directly editable by WYSIWYG editors
  3. XML based
  4. Human readable/editable source
  5. DOM tree can be modified by lot of libraries
  6. Vector based - Painless scaling
  7. Relatively small in size
  8. Extendable (as "X" in XML)
  9. You could open the slide and annotations in one image editor as layers
    ...etc.

How?
At least two of annotations formats are already xml based: mrxs and ndpa/ndpi.
XML to XML transforms are supposed to be done with XSLT templates.

On the other hand, the annotation file might not contain all data needed to properly transform. Still, we can use xml library and create the svg file.

I'll try to start with mrxs and maybe later with ndpa, I'm pretty sure It won't be complete. So far I've got mrxs annotations translated years ago (see demo here: http://lekarski.katowice.pl/ ) It will be functional for points, polygons/freehands and rectangles.

I think we should use pixel coordinates system of level 0 of the slide and transform to other levels with svg scaling.

@rferreiroa
Copy link

Is there any good solution for making annotations like markers, polygons /freehands in openseadragon over openslide? I saw a plugin but only rectangles can be done. Kind regards!

@boskar
Copy link
Author

boskar commented May 2, 2016

https://github.com/openseadragon/svg-overlay could be useful.

I've decided to keep openseadragon read-only in my setup, extract the overlays stored by Pannoramic Viewer or NDPView, and pass them to OSD.

@bgilbert
Copy link
Member

Hi @boskar, apologies for the delayed response. I'm not excited about requiring applications to parse SVG in order to obtain annotations. However, using an existing vector format would be better than implementing an entire custom vector API, so SVG may indeed be the right approach here.

I'm not convinced about producing the SVG with XSLT, though. XSLT can be pretty unreadable, plus it won't work for formats that don't store annotations as XML. I'd prefer OpenSlide to parse the annotations, draw them onto a Cairo surface, and then export the surface to SVG. That approach may not work, however, if Cairo doesn't support adding all of the necessary metadata (e.g. labels) to SVG output.

Please also discuss your plans on the openslide-users mailing list, since other users may have thoughts about annotation support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Requires API changes enhancement
Development

No branches or pull requests

3 participants