Skip to content

Commit 3ead5be

Browse files
committed
[Editor][WIP] Loader: Load all pre-annotations
1 parent d8f796d commit 3ead5be

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/editor/loaders/backend.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ import {
66
annotations,
77
boundingBoxes,
88
fixations,
9+
selectedAlgorithm,
910
selectedFixation
1011
} from '../data';
12+
import type {
13+
AnnotationDto
14+
} from '@/types/dtos/AnnotationDto';
1115
import type {
1216
AnnotationSessionDto
1317
} from '@/types/dtos/AnnotationSessionDto';
@@ -84,6 +88,27 @@ export const loadEditorDataFromBackend = async ( renderer: Renderer ) => {
8488
// NOTE: To use other disagreement measures, compute here
8589
} );
8690

91+
// Load additional algorithmic assignments
92+
const additionalAnnotationLoad = sessionData.value.inactiveMachineAnnotations!;
93+
94+
if ( additionalAnnotationLoad ) {
95+
selectedAlgorithm.value = 0;
96+
const algos = Object.keys( additionalAnnotationLoad );
97+
98+
algos.forEach( algo => {
99+
const details = additionalAnnotationLoad[ algo ]! as AnnotationDto;
100+
const ann: EditorAnnotation = {
101+
'fixationId': getFixIdxFromId( details.fixation!.id! ),
102+
'boxId': getBoxIdxFromId( details.characterBoundingBox!.id! ),
103+
'algorithm': algo
104+
};
105+
106+
fixations.value[ ann.fixationId ]!.assigned = details.annotationType === 'ANNOTATED' ? 'assigned' : 'machine';
107+
108+
annotations.value.push( ann );
109+
} );
110+
}
111+
87112
selectedFixation.value = 0;
88113

89114
// If none found that is unassigned, annotation is soft complete

0 commit comments

Comments
 (0)