biigle / largo

:m: BIIGLE module to review image annotations in a regular grid
GNU General Public License v3.0
0 stars 1 forks source link

Extend Largo to show the outline of the annotations #114

Closed dlangenk closed 5 months ago

dlangenk commented 8 months ago

This is more or less an extension of #30.

Especially for ML predicted annotations, checking if the outline is correct is very important. In addition ambiguous cases (#30), where multiple objects are in close proximity or the object is not in the center of the patch (e.g. for an object that is near an edge) can be made clear.

Technically we would generate another largo patch with the outline and overlay it over the current patch. We discussed this briefly and agreed on a blue colored outline at first (Is it possible to use CSS to set the color in the frontend to the color of the selected class?). A slider can then be used to set the opacity of the overlay as this might not be of interest to everybody.

mzur commented 8 months ago

Ideas for the implementation:

mzur commented 8 months ago

More ideas! The most challenging part with the separate SVG will be to transform the annotation coordinates in the SVG in the same way than the thumbnail is transformed (cropping and resizing here). But maybe it is very easy, too. The SVG can be created with the same dimensions than the original image, the annotation drawn onto it and then read as a Vips image. This image could maybe be cropped and resized exactly the same than the thumbnail!

If this works, we only have to think about the annotation style in the SVG. For example, if the annotation is drawn with a 5 px thick line and then the SVG is resized, the line may end up being 1 px thick. The thickness will vary across patches because each annotation thumbnail is resized differently. But in Largo the lines should all have the same style. Maybe the style can be defined via CSS in the frontend?

mzur commented 8 months ago

Oh, I could not find an SVG save function for Vips, so maybe that's a dead end :confused:

dlangenk commented 8 months ago

SVG is a rather simple format. We could also create the svg with a PHP function as it is just text. At that point we already have all the information like cropping and resizing. Crop is just subtracting the top and left coordinates and resizing is by a constant factor, which is computed during crop generation.

mzur commented 8 months ago

Or use something like meyfa/php-svg :wink: