From 6a3c339e4b2455aa82d45825ecc3d919afc84263 Mon Sep 17 00:00:00 2001 From: Martin Zurowietz Date: Thu, 7 Nov 2024 14:42:57 +0100 Subject: [PATCH] Include provenance and annotation files locally Otherwise these would be fetched via HTTP each time. --- assets/annotation-v2.0.0.json | 122 ++++++++++++++++++++++++++++++++++ assets/ifdo-v2.0.0.json | 8 +-- assets/ifdo-v2.0.1.json | 8 +-- assets/ifdo-v2.1.0.json | 8 +-- assets/provenance-v0.1.0.json | 106 +++++++++++++++++++++++++++++ 5 files changed, 240 insertions(+), 12 deletions(-) create mode 100644 assets/annotation-v2.0.0.json create mode 100644 assets/provenance-v0.1.0.json diff --git a/assets/annotation-v2.0.0.json b/assets/annotation-v2.0.0.json new file mode 100644 index 0000000..8ee28d0 --- /dev/null +++ b/assets/annotation-v2.0.0.json @@ -0,0 +1,122 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://marine-imaging.com/fair/schemas/annotation-v2.0.0.json", + "title": "Annotations of images", + "description": "A schema to establish a format for annotations within images (photos and videos) of different shape and by different annotators", + "type": "object", + "properties": { + "image-annotation-labels": { + "description": "All the labels used in the image-annotations. Specified by an id (e.g. AphiaID), a human-readable name and an optional description.", + "type": "array", + "items": { + "$ref": "#/$defs/label" + } + }, + "image-annotation-creators": { + "description": "All the annotators that created image-annotations. Specified by an id (e.g. ORCID), a human-readable name and an optional type specifying the annotator's expertise.", + "type": "array", + "items": { + "$ref": "#/$defs/annotator" + } + }, + "image-annotations": { + "description": "This field stores all annotations as a list of dictionaries of 3-4 fields: shape, coordinates, labels and (optional) frames. See further explanations below. The list of labels specifies the IDs or names of objects and annotators and their confidence. These should be specified in an `image-annotation-labels` and `image-annotation-creators` field (see above) to provide more information on the values used in these fields.", + "type": "array", + "items": { + "type": "object", + "properties": { + "shape": { + "description": "The annotation shape is specified by a keyword (allowed values: see enum).", + "type": "string", + "enum": [ + "single-pixel", + "polyline", + "polygon", + "circle", + "rectangle", + "ellipse", + "whole-image" + ] + }, + "coordinates": { + "description": "The pixel coordinates of one annotation. The top-left corner of an image is the (0,0) coordinate. The x-axis is the horizontal axis. Pixel coordinates may be fractional. Coordinates are to be given as a list of lists (only one element for photos, optionally multiple elements for videos). The required number of pixel coordinates is defined by the shape (0 for whole-image, 2 for single-pixel, 3 for circle, 8 for ellipse/rectangle, 4 or more for polyline, 8 or more for polygon). The third coordinate value of a circle defines the radius. The first and last coordinates of a polygon must be equal. Format: [[p1.x,p1.y,p2x,p2.y,...]..]", + "type": "array", + "items": { + "type": "array", + "items": { + "type": "number" + } + } + }, + "labels": { + "description": "The list of labels assigned to annotations by annotators", + "type": "array", + "items": { + "$ref": "#/$defs/annotation-label" + } + }, + "frames": { + "description": "(only required for video annotations) Frame times (in seconds from the beginning of a video) of a video annotation. Each frame time is linked to one entry in `image-annotations:coordinates` at the same position in the list, which specifies the current coordinates of the annotation at that frame.\nFormat: [f1,...]" + } + } + } + } + }, + "$defs": { + "annotation-label": { + "type": "object", + "required": ["label","annotator","created-at"], + "properties": { + "label": { + "description": "A unique identifier to a semantic label", + "type": "string" + }, + "annotator": { + "description": "A unique identifier to an annotation creator, e.g. orcid URL or handle to ML model", + "type": "string" + }, + "created-at": { + "description": "The date-time stamp of label creation", + "type": "string", + "format": "date-time" + }, + "confidence": { + "description": "A numerical confidence estimate of the validity of the label between 0 (untrustworthy) and 1 (100% certainty)", + "type": "number" + } + } + }, + "label": { + "type": "object", + "required": ["id","name"], + "properties": { + "id": { + "description": "A unique identifier to a semantic label", + "type": "string" + }, + "name": { + "description": "A human-readable name for the semantic label", + "type": "string" + }, + "info": { + "description": "A description on what this semantic label represents", + "type": "string" + } + } + }, + "annotator": { + "type": "object", + "required": ["id","name"], + "properties": { + "id": { + "description": "A unique identifier to an annotation creator, e.g. orcid URL or handle to ML model", + "type": "string" + }, + "name": { + "description": "A human-readable name for the annotator (identifying the specific human or machine)", + "type": "string" + } + } + } + } +} diff --git a/assets/ifdo-v2.0.0.json b/assets/ifdo-v2.0.0.json index d7006aa..386acca 100644 --- a/assets/ifdo-v2.0.0.json +++ b/assets/ifdo-v2.0.0.json @@ -285,13 +285,13 @@ } }, "image-annotation-labels": { - "$ref": "https://marine-imaging.com/fair/schemas/annotation-v2.0.0.json#/properties/image-annotation-labels" + "$ref": "annotation-v2.0.0.json#/properties/image-annotation-labels" }, "image-annotation-creators": { - "$ref": "https://marine-imaging.com/fair/schemas/annotation-v2.0.0.json#/properties/image-annotation-creators" + "$ref": "annotation-v2.0.0.json#/properties/image-annotation-creators" }, "image-annotations": { - "$ref": "https://marine-imaging.com/fair/schemas/annotation-v2.0.0.json#/properties/image-annotations" + "$ref": "annotation-v2.0.0.json#/properties/image-annotations" }, "image-acquisition": { "description": "photo: still images, video: moving images, slide: microscopy images / slide scans", @@ -717,7 +717,7 @@ } }, "image-set-provenance": { - "$ref": "https://marine-imaging.com/fair/schemas/provenance-v0.1.0.json" + "$ref": "provenance-v0.1.0.json" } } }, diff --git a/assets/ifdo-v2.0.1.json b/assets/ifdo-v2.0.1.json index 02c686a..ca60b2c 100644 --- a/assets/ifdo-v2.0.1.json +++ b/assets/ifdo-v2.0.1.json @@ -287,13 +287,13 @@ } }, "image-annotation-labels": { - "$ref": "https://marine-imaging.com/fair/schemas/annotation-v2.0.0.json#/properties/image-annotation-labels" + "$ref": "annotation-v2.0.0.json#/properties/image-annotation-labels" }, "image-annotation-creators": { - "$ref": "https://marine-imaging.com/fair/schemas/annotation-v2.0.0.json#/properties/image-annotation-creators" + "$ref": "annotation-v2.0.0.json#/properties/image-annotation-creators" }, "image-annotations": { - "$ref": "https://marine-imaging.com/fair/schemas/annotation-v2.0.0.json#/properties/image-annotations" + "$ref": "annotation-v2.0.0.json#/properties/image-annotations" }, "image-acquisition": { "description": "photo: still images, video: moving images, slide: microscopy images / slide scans", @@ -719,7 +719,7 @@ } }, "image-set-provenance": { - "$ref": "https://marine-imaging.com/fair/schemas/provenance-v0.1.0.json" + "$ref": "provenance-v0.1.0.json" } } }, diff --git a/assets/ifdo-v2.1.0.json b/assets/ifdo-v2.1.0.json index 74bf6e5..cc7d28b 100644 --- a/assets/ifdo-v2.1.0.json +++ b/assets/ifdo-v2.1.0.json @@ -287,13 +287,13 @@ } }, "image-annotation-labels": { - "$ref": "https://marine-imaging.com/fair/schemas/annotation-v2.0.0.json#/properties/image-annotation-labels" + "$ref": "annotation-v2.0.0.json#/properties/image-annotation-labels" }, "image-annotation-creators": { - "$ref": "https://marine-imaging.com/fair/schemas/annotation-v2.0.0.json#/properties/image-annotation-creators" + "$ref": "annotation-v2.0.0.json#/properties/image-annotation-creators" }, "image-annotations": { - "$ref": "https://marine-imaging.com/fair/schemas/annotation-v2.0.0.json#/properties/image-annotations" + "$ref": "annotation-v2.0.0.json#/properties/image-annotations" }, "image-acquisition": { "description": "photo: still images, video: moving images, slide: microscopy images / slide scans", @@ -719,7 +719,7 @@ } }, "image-set-provenance": { - "$ref": "https://marine-imaging.com/fair/schemas/provenance-v0.1.0.json" + "$ref": "provenance-v0.1.0.json" } } }, diff --git a/assets/provenance-v0.1.0.json b/assets/provenance-v0.1.0.json new file mode 100644 index 0000000..3309f3c --- /dev/null +++ b/assets/provenance-v0.1.0.json @@ -0,0 +1,106 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://marine-imaging.com/fair/schemas/provenance-v0.1.0.json", + "title": "Documenting a processing workflow", + "description": "A schema to document the agents, activities and entities that led to an image set entity", + "type": "object", + "properties": { + "provenance-agents": { + "type": "array", + "description": "A list of all the agents in this provenance documentation", + "items": { + "$ref": "#/$defs/agent" + } + }, + "provenance-entities": { + "type": "array", + "description": "A list of all the entities in this provenance documentation", + "items": { + "$ref": "#/$defs/entity" + } + }, + "provenance-activities": { + "type": "array", + "description": "A list of all the activities in this provenance documentation", + "items": { + "$ref": "#/$defs/activity" + } + } + }, + "$defs": { + "agent": { + "type": "object", + "description": "Someone or something that operates, takes responsibility, conducts, etc.", + "properties": { + "name": { + "type": "string", + "description": "A human-readable identifier of the agent" + }, + "id": { + "type": "string", + "description": "A unique identifier for the agent. Could be a uri." + } + } + }, + "entity": { + "type": "object", + "description": "A static instance of a virtual thing", + "properties": { + "name": { + "type": "string", + "description": "A human-readable identifier of the entity" + }, + "id": { + "type": "string", + "description": "A unique identifier for the entity. Could be a uri." + }, + "created-at": { + "type": "string", + "format": "date-time", + "description": "The time at which this entity was created in its entirety" + }, + "attributed-to": { + "type": "array", + "description": "A list of agents that relate to this entity", + "items": { + "$ref": "#/$defs/agent" + } + }, + "generated-by": { + "type": "array", + "description": "A list of activities that created this entity" + } + } + }, + "activity": { + "type": "object", + "description": "A process that works with entities and is operated by agents", + "properties": { + "start-time": { + "type": "string", + "format": "date-time", + "description": "The time at which the activity began" + }, + "end-time": { + "type": "string", + "format": "date-time", + "description": "The time at which the activity ended" + }, + "associated-agents": { + "type": "array", + "description": "The agents that are associated to this activity", + "items": { + "$ref": "#/$defs/agent" + } + }, + "used-entities": { + "type": "array", + "description": "The entities that are associated to this activity", + "items": { + "$ref": "#/$defs/entity" + } + } + } + } + } +}