Skip to main content

AnnotationExporter

@fovea/server


@fovea/server / services/export-handler / AnnotationExporter

Class: AnnotationExporter

Defined in: src/services/export-handler.ts:112

AnnotationExporter

Description

Handles exporting annotations with bounding box sequences.

Constructors

Constructor

new AnnotationExporter(): AnnotationExporter

Returns

AnnotationExporter

Methods

convertPrismaAnnotation()

convertPrismaAnnotation(prismaAnnotation): Annotation

Defined in: src/services/export-handler.ts:502

Convert Prisma annotation to export format. This handles the conversion from database format to the typed Annotation interface.

Parameters

prismaAnnotation

Annotation from Prisma

Returns

Annotation

Typed annotation


exportAnnotations()

exportAnnotations(annotations, options): string

Defined in: src/services/export-handler.ts:300

Export annotations to JSON Lines format.

Parameters

annotations

Annotation[]

Array of annotations to export

options

ExportOptions = {}

Export options

Returns

string

JSON Lines string (one JSON object per line)


exportFullSequence()

exportFullSequence(annotation): string

Defined in: src/services/export-handler.ts:211

Export full sequence with all interpolated frames. Useful for debugging or external tools that don't support interpolation. WARNING: File size can be 100x larger than keyframes-only export.

Parameters

annotation

Annotation

Annotation to export

Returns

string

JSON string with all interpolated frames


exportKeyframesOnly()

exportKeyframesOnly(annotation): string

Defined in: src/services/export-handler.ts:121

Export keyframes-only (recommended for most use cases). Exports only boxes where isKeyframe: true along with interpolation configuration. This preserves author intent and allows re-interpolation on import.

Parameters

annotation

Annotation

Annotation to export

Returns

string

JSON string with keyframes-only


getExportStats()

getExportStats(annotations, includeInterpolated): ExportStats

Defined in: src/services/export-handler.ts:321

Get export statistics for annotations.

Parameters

annotations

Annotation[]

Array of annotations

includeInterpolated

boolean = false

Whether interpolated frames are included

Returns

ExportStats

Export statistics


validateSequence()

validateSequence(sequence, videoWidth?, videoHeight?): SequenceValidationResult

Defined in: src/services/export-handler.ts:363

Validate a bounding box sequence before export.

Parameters

sequence

BoundingBoxSequence

Bounding box sequence to validate

videoWidth?

number

Video width in pixels (optional, for boundary validation)

videoHeight?

number

Video height in pixels (optional, for boundary validation)

Returns

SequenceValidationResult

Validation result