@osdlabel/annotation
v0.21.0
Published
Annotation data model for osdlabel.
Readme
@osdlabel/annotation
Pure annotation data model for osdlabel, a web-based image annotation library for gigapixel/DZI images.
This package has zero dependencies and contains no UI, serialization, or validation logic — just the immutable data model that every other osdlabel package builds on.
Installation
npm install @osdlabel/annotationWhat's inside
Annotation<E>— the generic annotation type (BaseAnnotation & E), extended via intersection by feature packagesBaseAnnotation,AnnotationStyle,AnnotationId(branded id)Geometry— discriminated union of geometry types (rectangle, circle, line, point, polyline, polygon)ToolType(rectangle,circle,line,point,polyline,freeHandPath) andtoolTypeToGeometryType— several tools can produce the same geometry, so the two unions are deliberately distinctDEFAULT_ANNOTATION_STYLERawAnnotationData<TFormat, TData>— generic raw-data containercreateAnnotationIdand other id/util helpers
Usage
import { type Annotation, type Geometry, createAnnotationId } from '@osdlabel/annotation';
const id = createAnnotationId('ann-1');IDs are branded types — always construct them through the factory functions rather than casting raw strings.
License
BSD-3-Clause. Part of the osdlabel monorepo.
