gu-gridh / multimodal-viewer

2 stars 0 forks source link

Adding annotations #22

Closed jonathanwestin closed 3 weeks ago

jonathanwestin commented 1 month ago

The annotation function should allow the user to 1) mark out an area √ 2) save that area as a new inscription with an image for that area √ 3) add metadata to that inscription √ 4) the metadata should be shown in the metadata-panel when a user clicks on an existing annotation area

Complications: all except perhaps marking out an area should be behind some sort of login. Different solutions: a) when the user confirms area they are linked to the the backend login (and the selected area is brought with them and autofilled for a new inscription object perhaps through an exported json-file that they import?). or b) the metadata-module is exchanged for a form where the user adds the data. When saving the form a login is requested and if successful the form is processed by Django into an inscription object. or c) a variation of b that lets the user export a json that can then be imported in the backend (for those user that have a login and can get to the backend that is)

jonathanwestin commented 1 month ago

Or: if there was a way to annotate a iiif-image in Django then we could do it all there, but i reckon the easiest way is probably to produce a json through the frontend that the user later imports into Django when creating an inscription object. The json would carry information about 1) what surface it concerns 2) where to "draw" the annotation-rectangle in that surface's orthophoto, and 3) how to crop that orthophoto for the gallery view.

TristanBridge commented 1 month ago

This is the format for annotations we have working in the frontend:

[
    {
        "@context": "http://www.w3.org/ns/anno.jsonld",
        "type": "Annotation",
        "body": [
          {
            "type": "TextualBody",
            "value": "Test Sophia Annotation 1",
            "purpose": "commenting"
          }
        ],
        "target": {
          "source": "https://img.dh.gu.se/diana/static/shfa/iiif/f0d9f217-defd-48ff-a24f-6ccfd9f14be3.tif",
          "selector": {
            "type": "FragmentSelector",
            "conformsTo": "http://www.w3.org/TR/media-frags/",
            "value": "xywh=pixel:519.1285400390625,1435.9532470703125,894.7603759765625,496.2691650390625"
          }
        },
        "id": "#90e12559-d6b3-4a18-9a47-5ba68c3f735a"
      },
      {
        "@context": "http://www.w3.org/ns/anno.jsonld",
        "type": "Annotation",
        "body": [
          {
            "type": "TextualBody",
            "value": "Test Sophia Annotation 2",
            "purpose": "commenting"
          }
        ],
        "target": {
          "source": "https://img.dh.gu.se/diana/static/shfa/iiif/f0d9f217-defd-48ff-a24f-6ccfd9f14be3.tif",
          "selector": {
            "type": "FragmentSelector",
            "conformsTo": "http://www.w3.org/TR/media-frags/",
            "value": "xywh=pixel:502.77783203125,556.666748046875,1213.333251953125,511.1109619140625"
          }
        },
        "id": "#6a79a718-2607-4526-9752-7b4c33c9af35"
      }
]
jonathanwestin commented 1 month ago

Alternatively, the annotation tool in the frontend could have a "copy coordinates" button, and the user would use that to get something to paste into the right field in the backend for the inscription object. Would save them some file handling. That is what we are doing with the start-positions for the point cloud. Would ofcourse be even better if the same coordinates could be used when getting the crop of the iiif for the gallery.

jonathanwestin commented 1 month ago

Basically, what needs to be copied is this comma-separated string (from the example above): 519.1285400390625, 1435.9532470703125, 894.7603759765625, 496.2691650390625

I don't think it is necessary that all the decimals are kept, so perhaps it is enough if the first three are copied (for a cleaner look in the backend when pasted). @TristanBridge

jonathanwestin commented 1 month ago

https://github.com/gu-gridh/multimodal-viewer/assets/70022179/d6fd27c4-a665-49af-8f6f-898f5f9773ed

@TristanBridge Ideally, when the user has clicked "copy position" a new tab with this url would be launched: https://saintsophia.dh.gu.se/admin/inscriptions/inscription/ (however this would have to be a placeholder decided in config or app so it can be different for different projects).

@mtomasini it would be good if the field to paste the position coordinates was at the top and very clearly labelled, as that would be the natural thing to start with (since the coordinates are in clipboard-memory).

Finally we would need some way that lets Tristan fetch all available annotation positions for a surface in the frontend that is compatible with the format Tristan posted above.