Data Loaders
Annota provides data loaders for importing annotations from various file formats commonly used in digital pathology.
H5 (HDF5) Files
Section titled “H5 (HDF5) Files”Loading Mask Annotations
Section titled “Loading Mask Annotations”Load polygon annotations from HDF5 mask files:
import { loadH5Masks } from "annota";
const annotations = await loadH5Masks("/path/to/masks.h5", { color: "#FF0000", fillOpacity: 0.3,});Loading Coordinate Points
Section titled “Loading Coordinate Points”Load point annotations from HDF5 coordinate files:
import { loadH5Coordinates } from "annota";
const points = await loadH5Coordinates("/path/to/coords.h5", { color: "#00FF00", fillOpacity: 0.8,});JSON Files
Section titled “JSON Files”Loading
Section titled “Loading”import { loadJSONFile } from "annota";
const annotations = loadJSONFile(jsonData);Exporting
Section titled “Exporting”import { annotationsToJSON } from "annota";
const json = annotationsToJSON(annotations);PGM Files
Section titled “PGM Files”Loading Masks
Section titled “Loading Masks”import { loadPgmFile } from "annota";
const annotations = loadPgmFile(pgmData, { threshold: 128,});Extracting Polygons
Section titled “Extracting Polygons”import { loadPgmPolygons } from "annota";
const polygons = loadPgmPolygons(pgmData, { threshold: 128,});Exporting
Section titled “Exporting”import { annotationsToPgm } from "annota";
const pgmData = annotationsToPgm(annotations, width, height);See Also
Section titled “See Also”- API Reference — Complete loader API
- H5 Loading Use Case — Complete example