Share via the BioImage Archive¶
Annotations are most useful when others can reuse them. The BioImage Archive accepts annotation datasets described with the MIFA metadata standard. OMERO Annotate AI writes a ready-to-upload bundle: images, masks, file lists and the MIFA metadata files.
This needs the BioImage Archive's metadata models, which are not on PyPI:
1. Describe the study¶
The config has three metadata sections used for the archive: study, dataset and
annotation_methodology. Fill them in the YAML before annotating, or set them just before
export:
study:
title: "Nuclei annotations in HeLa Cell Painting images"
description: "Instance masks of nuclei, annotated with micro-SAM and corrected by hand."
keywords: [nuclei, segmentation, cell painting]
organism: "Homo sapiens"
imaging_method: "widefield fluorescence microscopy"
funding_statement: "Funded by NWO."
dataset:
source_description: "HeLa cells, Hoechst channel"
license: "CC-BY-4.0" # CC0 or CC-BY
annotation_methodology:
annotation_type: segmentation_mask
annotation_method: semi_automatic
annotation_criteria: "Every nucleus fully inside the field; touching nuclei separated."
annotation_coverage: representative
2. Export from OMERO¶
from omero_annotate_ai import prepare_bia_data_from_table
from omero_annotate_ai.core.mifa_export import save_bia_package
from omero_annotate_ai.trainingset import read_set_config
config = read_set_config(table_id, conn) # the set's config, with the study metadata
stats = prepare_bia_data_from_table(conn, table_id, "bia_staging")
summary = save_bia_package(
config, stats["rows"], "bia_staging", "bia_bundle", move_data=True
)
prepare_bia_data_from_table downloads the finished units in their original bit depth;
save_bia_package writes the bundle.
From a local training set¶
from omero_annotate_ai import TrainingSet
from omero_annotate_ai.core.mifa_export import save_bia_package
ts = TrainingSet.open("~/omero_annotate_ai/local/<id>_hela_nuclei_v1")
save_bia_package(
ts.config, ts.units(), ts.bundle_dir, "bia_bundle"
) # annotated units only
What is in the bundle¶
bia_bundle/
├── metadata/
│ ├── Study_<accession>.yaml
│ ├── Annotations_<accession>.yaml
│ └── Version_<accession>.yaml
├── file_list_images.tsv
├── file_list_annotations.tsv
├── images/<unit id>.tif
└── annotations/<unit id>_mask.tif
Upload it following the BioImage Archive submission guide.
Notebook: OMERO table to BioImage Archive