Skip to content

Commit

Permalink
Merge pull request #630 from biigle/annotation-linking-bug
Browse files Browse the repository at this point in the history
Prevent linking annotations of different labels
  • Loading branch information
mzur authored Aug 9, 2023
2 parents 772f9f7 + 71800e2 commit e1ae648
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ export default {
allowedSplitShapes.indexOf(this.selectedAnnotations[0].shape) === -1;
},
cannotLinkAnnotations() {
return this.selectedAnnotations.length !== 2 || this.selectedAnnotations[0].shape_id !== this.selectedAnnotations[1].shape_id;
return this.selectedAnnotations.length !== 2
|| this.selectedAnnotations[0].shape_id !== this.selectedAnnotations[1].shape_id
|| this.selectedAnnotations[0].labels.length !== this.selectedAnnotations[1].labels.length
|| !this.labelsAreIdentical(this.selectedAnnotations[0], this.selectedAnnotations[1]);
},
isAttaching() {
return this.interactionMode === 'attachLabel';
Expand All @@ -40,6 +43,12 @@ export default {
},
},
methods: {
labelsAreIdentical(a, b) {
let labelIdsA = a.labels.map(l => l.label_id);
let labelIdsB = b.labels.map(l => l.label_id);
return labelIdsA.every(id => labelIdsB.includes(id));
},
initModifyInteraction(map) {
// Map to detect which features were changed between modifystart and
// modifyend events of the modify interaction.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<h3><a name="link-annotation-clips"></a><i class="fa fa-link"></i> Link annotation clips</h3>
<p>
Sometimes an object or region of interest (ROI) might disappear from the video and reappear at a later time. To still count this object or ROI as a single annotation, annotation clips can be linked. First, create two separate annotation clips, marking the object or ROI at both times at which it is visible in the video. Next, select both annotation clips. Finally, click the <button class="btn btn-xs btn-default"><i class="fa fa-link"></i></button> button in the tool bar to link the two annotation clips. The result is a single annotation clip with a gap, which is marked with a dotted line between two keyframes. You can repeat this process to create an annotation clip with several gaps.
Sometimes an object or region of interest (ROI) might disappear from the video and reappear at a later time. To still count this object or ROI as a single annotation, annotation clips can be linked. First, create two separate annotation clips of equal label and shape, marking the object or ROI at both times at which it is visible in the video. Next, select both annotation clips. Finally, click the <button class="btn btn-xs btn-default"><i class="fa fa-link"></i></button> button in the tool bar to link the two annotation clips. The result is a single annotation clip with a gap, which is marked with a dotted line between two keyframes. You can repeat this process to create an annotation clip with several gaps.
</p>
<p class="text-center">
<a href="{{asset('assets/images/manual/videos/editing_annotations_2.jpg')}}"><img src="{{asset('assets/images/manual/videos/editing_annotations_2.jpg')}}" width="33%"></a><br>
Expand Down

0 comments on commit e1ae648

Please sign in to comment.