lost-sia 2.0.1-alpha8 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/Annotation/logic/Annotation.d.ts +17 -0
- package/dist/Annotation/logic/Annotation.js +1 -0
- package/dist/Annotation/ui/AnnotationComponent.d.ts +24 -0
- package/dist/Annotation/ui/AnnotationComponent.js +1 -0
- package/dist/Annotation/ui/atoms/AnnoBar.d.ts +15 -0
- package/dist/Annotation/ui/atoms/AnnoBar.js +1 -0
- package/dist/Annotation/ui/atoms/DaviIcon.d.ts +9 -0
- package/dist/Annotation/ui/atoms/DaviIcon.js +19 -0
- package/dist/Annotation/ui/atoms/Edge.d.ts +17 -0
- package/dist/Annotation/ui/atoms/Edge.js +1 -0
- package/dist/Annotation/ui/atoms/Node.d.ts +17 -0
- package/dist/Annotation/ui/atoms/Node.js +1 -0
- package/dist/Annotation/ui/atoms/PolygonArea.d.ts +16 -0
- package/dist/Annotation/ui/atoms/PolygonArea.js +1 -0
- package/dist/Annotation/ui/tools/BBox.d.ts +21 -0
- package/dist/Annotation/ui/tools/BBox.js +1 -0
- package/dist/Annotation/ui/tools/Line.d.ts +21 -0
- package/dist/Annotation/ui/tools/Line.js +1 -0
- package/dist/Annotation/ui/tools/Point.d.ts +16 -0
- package/dist/Annotation/ui/tools/Point.js +1 -0
- package/dist/Annotation/ui/tools/Polygon.d.ts +23 -0
- package/dist/Annotation/ui/tools/Polygon.js +1 -0
- package/dist/Canvas/Canvas.d.ts +31 -0
- package/dist/Canvas/Canvas.js +1 -0
- package/dist/Canvas/LabelInput.d.ts +11 -0
- package/dist/Canvas/LabelInput.js +1 -0
- package/dist/IconButton.d.ts +25 -0
- package/dist/IconButton.js +1 -0
- package/dist/Sia.d.ts +33 -0
- package/dist/Sia.js +1 -0
- package/dist/Toolbar/Toolbar.d.ts +21 -0
- package/dist/Toolbar/Toolbar.js +1 -0
- package/dist/Toolbar/ToolbarItems/AccessibilityTools.d.ts +7 -0
- package/dist/Toolbar/ToolbarItems/AccessibilityTools.js +1 -0
- package/dist/Toolbar/ToolbarItems/AnnoToolSelector.d.ts +11 -0
- package/dist/Toolbar/ToolbarItems/AnnoToolSelector.js +1 -0
- package/dist/Toolbar/ToolbarItems/ImageToolItems/ImageLabelInput.d.ts +11 -0
- package/dist/Toolbar/ToolbarItems/ImageToolItems/ImageLabelInput.js +1 -0
- package/dist/Toolbar/ToolbarItems/ImageToolItems/TagLabel.d.ts +11 -0
- package/dist/Toolbar/ToolbarItems/ImageToolItems/TagLabel.js +1 -0
- package/dist/Toolbar/ToolbarItems/ImageTools.d.ts +13 -0
- package/dist/Toolbar/ToolbarItems/ImageTools.js +1 -0
- package/dist/Toolbar/ToolbarItems/Instructions.d.ts +2 -0
- package/dist/Toolbar/ToolbarItems/Instructions.js +1 -0
- package/dist/Toolbar/ToolbarItems/InstructionsModal.d.ts +6 -0
- package/dist/Toolbar/ToolbarItems/InstructionsModal.js +1 -0
- package/dist/assets/SIA-BV1tYu3P.css +1 -0
- package/dist/assets/brand-icons-Cu_C0hZ4.svg +1008 -0
- package/dist/assets/brand-icons-F3SPCeH1.woff +0 -0
- package/dist/assets/brand-icons-XL9sxUpA.woff2 +0 -0
- package/dist/assets/brand-icons-sqJ2Pg7a.eot +0 -0
- package/dist/assets/brand-icons-ubhWoxly.ttf +0 -0
- package/dist/assets/flags-DOLqOU7Y.png +0 -0
- package/dist/assets/icons-BOCtAERH.woff +0 -0
- package/dist/assets/icons-CHzK1VD9.eot +0 -0
- package/dist/assets/icons-D29ZQHHw.ttf +0 -0
- package/dist/assets/icons-Du6TOHnR.woff2 +0 -0
- package/dist/assets/icons-RwhydX30.svg +1518 -0
- package/dist/assets/node_modules/semantic-ui-css/semantic.min-Bvulf91l.css +346 -0
- package/dist/assets/outline-icons-BfdLr8tr.svg +366 -0
- package/dist/assets/outline-icons-DD8jm0uy.ttf +0 -0
- package/dist/assets/outline-icons-DInHoiqI.woff2 +0 -0
- package/dist/assets/outline-icons-LX8adJ4n.eot +0 -0
- package/dist/assets/outline-icons-aQ88nltS.woff +0 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1 -0
- package/dist/models/AnnotationMode.d.ts +11 -0
- package/dist/models/AnnotationMode.js +1 -0
- package/dist/models/AnnotationStatus.d.ts +8 -0
- package/dist/models/AnnotationStatus.js +1 -0
- package/dist/models/AnnotationTool.d.ts +7 -0
- package/dist/models/AnnotationTool.js +1 -0
- package/dist/models/CanvasAction.d.ts +28 -0
- package/dist/models/CanvasAction.js +1 -0
- package/dist/models/Direction.d.ts +7 -0
- package/dist/models/Direction.js +1 -0
- package/dist/models/EditorModes.d.ts +11 -0
- package/dist/models/EditorModes.js +1 -0
- package/dist/models/KeyAction.d.ts +22 -0
- package/dist/models/KeyAction.js +1 -0
- package/dist/models/NotificationType.d.ts +7 -0
- package/dist/models/NotificationType.js +1 -0
- package/dist/models/index.d.ts +6 -0
- package/dist/models/index.js +1 -0
- package/dist/stories/AnnotationTools.stories.d.ts +40 -0
- package/dist/stories/Canvas/Canvas.stories.d.ts +50 -0
- package/dist/stories/Canvas/CanvasOffset.d.ts +13 -0
- package/dist/stories/Canvas/CanvasWithOffset.stories.d.ts +36 -0
- package/dist/stories/FilterDropdown.stories.d.ts +19 -0
- package/dist/stories/MinimalSia.stories.d.ts +66 -0
- package/dist/stories/SIA/DemoWrapper.d.ts +8 -0
- package/dist/stories/SIA/DemoWrapper.stories.d.ts +27 -0
- package/dist/stories/SIA/SIA.stories.d.ts +72 -0
- package/dist/stories/Toolbar/ImageTools/TagLabel.stories.d.ts +21 -0
- package/dist/stories/Toolbar/Instructions.stories.d.ts +11 -0
- package/dist/stories/Toolbar/Toolbar.stories.d.ts +37 -0
- package/dist/stories/exampleData/exampleAnnotations.d.ts +8 -0
- package/dist/stories/exampleData/exampleExternalAnnotations.d.ts +8 -0
- package/dist/stories/exampleData/exampleImage.d.ts +2 -0
- package/dist/stories/exampleData/exampleLabels.d.ts +6 -0
- package/dist/types.d.ts +57 -0
- package/dist/types.js +1 -0
- package/dist/utils/KeyMapper.d.ts +9 -0
- package/dist/utils/KeyMapper.js +1 -0
- package/dist/utils/TimeUtils.d.ts +4 -0
- package/dist/utils/TimeUtils.js +1 -0
- package/dist/utils/color.d.ts +2 -0
- package/dist/utils/color.js +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/mouse.d.ts +6 -0
- package/dist/utils/mouse.js +1 -0
- package/dist/utils/siaIcons.js +12 -0
- package/dist/utils/transform.d.ts +28 -0
- package/dist/utils/transform.js +1 -0
- package/dist/utils/uiConfig.js +1 -0
- package/dist/utils/windowViewport.d.ts +22 -0
- package/dist/utils/windowViewport.js +1 -0
- package/package.json +19 -16
- package/src/AnnoExampleViewer.jsx +18 -18
- package/src/Annotation/logic/Annotation.ts +24 -26
- package/src/Annotation/ui/AnnotationComponent.tsx +115 -86
- package/src/Annotation/ui/atoms/AnnoBar.tsx +51 -53
- package/src/Annotation/ui/atoms/DaviIcon.tsx +12 -22
- package/src/Annotation/ui/atoms/Edge.tsx +25 -22
- package/src/Annotation/ui/atoms/Node.tsx +56 -50
- package/src/Annotation/ui/atoms/PolygonArea.tsx +30 -35
- package/src/Annotation/ui/tools/BBox.tsx +136 -150
- package/src/Annotation/ui/tools/Line.tsx +94 -91
- package/src/Annotation/ui/tools/Point.tsx +19 -17
- package/src/Annotation/ui/tools/Polygon.tsx +126 -95
- package/src/Canvas/Canvas.tsx +748 -594
- package/src/Canvas/LabelInput.tsx +68 -45
- package/src/IconButton.tsx +119 -0
- package/src/InfoBoxes/AnnoDetails.jsx +53 -53
- package/src/InfoBoxes/AnnoStats.jsx +41 -41
- package/src/InfoBoxes/InfoBox.jsx +16 -16
- package/src/InfoBoxes/InfoBoxArea.jsx +32 -34
- package/src/InfoBoxes/LabelInfo.jsx +30 -30
- package/src/SIASettingButton.jsx +25 -25
- package/src/Sia.tsx +484 -0
- package/src/Toolbar/Toolbar.tsx +38 -31
- package/src/Toolbar/ToolbarItems/AccessibilityTools.tsx +26 -46
- package/src/Toolbar/ToolbarItems/AnnoToolSelector.tsx +53 -46
- package/src/Toolbar/ToolbarItems/ImageToolItems/ImageLabelInput.tsx +127 -0
- package/src/Toolbar/ToolbarItems/ImageToolItems/TagLabel.tsx +29 -28
- package/src/Toolbar/ToolbarItems/ImageTools.tsx +43 -40
- package/src/Toolbar/ToolbarItems/Instructions.tsx +47 -50
- package/src/Toolbar/ToolbarItems/InstructionsModal.tsx +8 -8
- package/src/index.ts +9 -13
- package/src/models/{AnnotationMode.tsx → AnnotationMode.ts} +1 -1
- package/src/models/{AnnotationStatus.tsx → AnnotationStatus.ts} +1 -1
- package/src/models/{AnnotationTool.tsx → AnnotationTool.ts} +1 -1
- package/src/models/{CanvasAction.tsx → CanvasAction.ts} +1 -1
- package/src/models/{Direction.tsx → Direction.ts} +1 -1
- package/src/models/{EditorModes.tsx → EditorModes.ts} +1 -1
- package/src/models/{KeyAction.tsx → KeyAction.ts} +3 -1
- package/src/models/NotificationType.ts +8 -0
- package/src/models/index.ts +6 -7
- package/src/siaDummyData.js +71 -71
- package/src/stories/AnnotationTools.mdx +27 -0
- package/src/stories/AnnotationTools.stories.tsx +104 -0
- package/src/stories/Canvas/Canvas.stories.tsx +59 -113
- package/src/stories/Canvas/CanvasOffset.tsx +54 -38
- package/src/stories/Canvas/CanvasWithOffset.stories.tsx +42 -113
- package/src/stories/FilterDropdown.stories.ts +13 -11
- package/src/stories/MinimalSIA.mdx +20 -0
- package/src/stories/MinimalSia.stories.tsx +90 -0
- package/src/stories/SIA/DemoWrapper.stories.tsx +71 -0
- package/src/stories/SIA/DemoWrapper.tsx +55 -0
- package/src/stories/SIA/SIA.stories.tsx +79 -45
- package/src/stories/Toolbar/ImageTools/TagLabel.stories.tsx +11 -12
- package/src/stories/Toolbar/Instructions.stories.tsx +11 -11
- package/src/stories/Toolbar/Toolbar.stories.tsx +32 -47
- package/src/stories/Welcome.mdx +5 -0
- package/src/stories/development/CoordinateSystems.mdx +25 -0
- package/src/stories/exampleData/exampleAnnotations.ts +65 -0
- package/src/stories/exampleData/exampleExternalAnnotations.ts +115 -0
- package/src/stories/{siaDummyData2.ts → exampleData/exampleImage.ts} +3 -264
- package/src/stories/exampleData/exampleLabels.ts +146 -0
- package/src/stories/main.scss +6 -0
- package/src/styles/style.scss +1 -26
- package/src/types.ts +67 -0
- package/src/utils/KeyMapper.ts +76 -74
- package/src/utils/TimeUtils.ts +11 -0
- package/src/utils/color.ts +25 -25
- package/src/utils/hist.js +22 -22
- package/src/utils/index.ts +2 -3
- package/src/utils/mouse.ts +45 -0
- package/src/utils/siaIcons.jsx +5 -7
- package/src/utils/transform.ts +186 -0
- package/src/utils/uiConfig.js +19 -22
- package/src/utils/windowViewport.ts +34 -0
- package/src/AnnoLabelInput.jsx +0 -109
- package/src/AnnoToolBar.jsx +0 -153
- package/src/Annotation/AnnoBar.jsx +0 -154
- package/src/Annotation/Annotation.jsx +0 -395
- package/src/Annotation/Annotation.scss +0 -47
- package/src/Annotation/BBox.jsx +0 -299
- package/src/Annotation/Edge.jsx +0 -92
- package/src/Annotation/InfSelectionArea.jsx +0 -72
- package/src/Annotation/Line.jsx +0 -68
- package/src/Annotation/Node.jsx +0 -282
- package/src/Annotation/Point.jsx +0 -200
- package/src/Annotation/Polygon.jsx +0 -404
- package/src/Annotation/logic/AnnotationUtils.ts +0 -30
- package/src/Canvas.jsx +0 -2194
- package/src/ImgBar.jsx +0 -131
- package/src/LabelInput.jsx +0 -238
- package/src/Prompt.jsx +0 -45
- package/src/SIAFilterButton.jsx +0 -186
- package/src/Sia.jsx +0 -478
- package/src/Sia2.tsx +0 -392
- package/src/SiaPopup.jsx +0 -15
- package/src/ToolBar.jsx +0 -463
- package/src/Toolbar/NavigationButtons.tsx +0 -21
- package/src/Toolbar/ToolbarItem.jsx +0 -30
- package/src/Toolbar/ToolbarItems/ImageToolItems/ImageLabel.tsx +0 -62
- package/src/Toolbar.css +0 -13
- package/src/ToolbarItem.jsx +0 -31
- package/src/filterTools.js +0 -5
- package/src/models/AllowedTools.tsx +0 -9
- package/src/models/AnnotationSettings.tsx +0 -9
- package/src/models/ExternalAnnotation.ts +0 -15
- package/src/models/Label.tsx +0 -8
- package/src/models/UiConfig.tsx +0 -6
- package/src/stories/Button.jsx +0 -54
- package/src/stories/Button.stories.js +0 -48
- package/src/stories/Header.jsx +0 -69
- package/src/stories/Header.stories.js +0 -28
- package/src/stories/Page.jsx +0 -87
- package/src/stories/Page.stories.js +0 -28
- package/src/stories/SIA2/DemoWrapper.stories.tsx +0 -167
- package/src/stories/SIA2/DemoWrapper.tsx +0 -54
- package/src/stories/SIA2/Sia2.stories.tsx +0 -62
- package/src/stories/Toolbar/ImageTools/ImageLabel.stories.tsx +0 -32
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -5
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -15
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -3
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -12
- package/src/stories/assets/youtube.svg +0 -4
- package/src/stories/button.css +0 -30
- package/src/stories/header.css +0 -32
- package/src/stories/lost.js +0 -54
- package/src/stories/page.css +0 -69
- package/src/stories/siaDummyData.js +0 -263
- package/src/stories/store.js +0 -18
- package/src/test.js +0 -7
- package/src/types/annoStatus.js +0 -4
- package/src/types/canvasActions.js +0 -58
- package/src/types/cursorstyles.js +0 -3
- package/src/types/modes.js +0 -9
- package/src/types/notificationType.js +0 -11
- package/src/types/toolbarEvents.js +0 -35
- package/src/types/tools.js +0 -17
- package/src/types.tsx +0 -11
- package/src/utils/annoConversion.js +0 -145
- package/src/utils/annoConversion2.ts +0 -145
- package/src/utils/colorlut.js +0 -68
- package/src/utils/constraints.js +0 -81
- package/src/utils/index.js +0 -1
- package/src/utils/keyActions.js +0 -113
- package/src/utils/mouse.js +0 -14
- package/src/utils/mouse2.ts +0 -35
- package/src/utils/transform.js +0 -336
- package/src/utils/transform2.ts +0 -343
- package/src/utils/windowViewport.js +0 -34
- package/src/utils/windowViewport2.ts +0 -50
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as siaIcons from
|
|
3
|
-
import { useState } from "react";
|
|
1
|
+
import { CButtonGroup } from '@coreui/react'
|
|
2
|
+
import * as siaIcons from '../../utils/siaIcons'
|
|
4
3
|
|
|
5
|
-
import AnnotationTool from
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import { faTrash } from "@fortawesome/free-solid-svg-icons";
|
|
4
|
+
import AnnotationTool from '../../models/AnnotationTool'
|
|
5
|
+
import { faTrash } from '@fortawesome/free-solid-svg-icons'
|
|
6
|
+
import { AllowedTools } from '../../types'
|
|
7
|
+
import IconButton from '../../IconButton'
|
|
10
8
|
|
|
11
9
|
type AnnoToolSelectorProps = {
|
|
12
|
-
allowedTools: AllowedTools
|
|
13
|
-
isDisabled?: boolean
|
|
14
|
-
selectedTool: AnnotationTool
|
|
15
|
-
onSetSelectedTool: (selectedTool: AnnotationTool) => void
|
|
16
|
-
onShouldDeleteSelectedAnnotation?: () => void
|
|
17
|
-
}
|
|
10
|
+
allowedTools: AllowedTools
|
|
11
|
+
isDisabled?: boolean
|
|
12
|
+
selectedTool: AnnotationTool
|
|
13
|
+
onSetSelectedTool: (selectedTool: AnnotationTool) => void
|
|
14
|
+
onShouldDeleteSelectedAnnotation?: () => void
|
|
15
|
+
}
|
|
18
16
|
|
|
19
17
|
const AnnoToolSelector = ({
|
|
20
18
|
allowedTools,
|
|
@@ -23,66 +21,75 @@ const AnnoToolSelector = ({
|
|
|
23
21
|
onSetSelectedTool,
|
|
24
22
|
onShouldDeleteSelectedAnnotation = () => {},
|
|
25
23
|
}: AnnoToolSelectorProps) => {
|
|
26
|
-
// const [selectedTool, setSelectedTool] = useState<AnnotationTool>(defaultTool);
|
|
27
|
-
|
|
28
24
|
return (
|
|
29
25
|
<CButtonGroup role="group" aria-label="Basic example">
|
|
30
26
|
{allowedTools.point && (
|
|
31
|
-
<CButton
|
|
27
|
+
// <CButton
|
|
28
|
+
// color="primary"
|
|
29
|
+
// disabled={isDisabled}
|
|
30
|
+
// variant={selectedTool == AnnotationTool.Point ? undefined : 'outline'}
|
|
31
|
+
// onClick={() => onSetSelectedTool(AnnotationTool.Point)}
|
|
32
|
+
// >
|
|
33
|
+
// {siaIcons.pointIcon()}
|
|
34
|
+
// </CButton>
|
|
35
|
+
<IconButton
|
|
32
36
|
color="primary"
|
|
37
|
+
text={siaIcons.pointIcon()}
|
|
38
|
+
isOutline={selectedTool != AnnotationTool.Point}
|
|
33
39
|
disabled={isDisabled}
|
|
34
|
-
variant={selectedTool == AnnotationTool.Point ? undefined : "outline"}
|
|
35
40
|
onClick={() => onSetSelectedTool(AnnotationTool.Point)}
|
|
36
|
-
|
|
37
|
-
{
|
|
38
|
-
|
|
41
|
+
tooltip="Create Point Annotation"
|
|
42
|
+
margin={0}
|
|
43
|
+
/>
|
|
39
44
|
)}
|
|
40
45
|
|
|
41
46
|
{allowedTools.line && (
|
|
42
|
-
<
|
|
47
|
+
<IconButton
|
|
43
48
|
color="primary"
|
|
49
|
+
text={siaIcons.lineIcon()}
|
|
50
|
+
isOutline={selectedTool != AnnotationTool.Line}
|
|
44
51
|
disabled={isDisabled}
|
|
45
|
-
variant={selectedTool == AnnotationTool.Line ? undefined : "outline"}
|
|
46
52
|
onClick={() => onSetSelectedTool(AnnotationTool.Line)}
|
|
47
|
-
|
|
48
|
-
{
|
|
49
|
-
|
|
53
|
+
tooltip="Create Line Annotation"
|
|
54
|
+
margin={0}
|
|
55
|
+
/>
|
|
50
56
|
)}
|
|
51
57
|
|
|
52
58
|
{allowedTools.bbox && (
|
|
53
|
-
<
|
|
59
|
+
<IconButton
|
|
54
60
|
color="primary"
|
|
61
|
+
text={siaIcons.bBoxIcon()}
|
|
62
|
+
isOutline={selectedTool != AnnotationTool.BBox}
|
|
55
63
|
disabled={isDisabled}
|
|
56
|
-
variant={selectedTool == AnnotationTool.BBox ? undefined : "outline"}
|
|
57
64
|
onClick={() => onSetSelectedTool(AnnotationTool.BBox)}
|
|
58
|
-
|
|
59
|
-
{
|
|
60
|
-
|
|
65
|
+
tooltip="Create BBox Annotation"
|
|
66
|
+
margin={0}
|
|
67
|
+
/>
|
|
61
68
|
)}
|
|
62
69
|
|
|
63
70
|
{allowedTools.polygon && (
|
|
64
|
-
<
|
|
71
|
+
<IconButton
|
|
65
72
|
color="primary"
|
|
73
|
+
text={siaIcons.polygonIcon()}
|
|
74
|
+
isOutline={selectedTool != AnnotationTool.Polygon}
|
|
66
75
|
disabled={isDisabled}
|
|
67
|
-
variant={
|
|
68
|
-
selectedTool == AnnotationTool.Polygon ? undefined : "outline"
|
|
69
|
-
}
|
|
70
76
|
onClick={() => onSetSelectedTool(AnnotationTool.Polygon)}
|
|
71
|
-
|
|
72
|
-
{
|
|
73
|
-
|
|
77
|
+
tooltip="Create Polygon Annotation"
|
|
78
|
+
margin={0}
|
|
79
|
+
/>
|
|
74
80
|
)}
|
|
75
81
|
|
|
76
|
-
<
|
|
82
|
+
<IconButton
|
|
77
83
|
color="primary"
|
|
78
|
-
|
|
84
|
+
icon={faTrash}
|
|
85
|
+
isOutline={true}
|
|
79
86
|
disabled={isDisabled}
|
|
80
87
|
onClick={onShouldDeleteSelectedAnnotation}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
tooltip="Delete selected annotation"
|
|
89
|
+
margin={0}
|
|
90
|
+
/>
|
|
84
91
|
</CButtonGroup>
|
|
85
|
-
)
|
|
86
|
-
}
|
|
92
|
+
)
|
|
93
|
+
}
|
|
87
94
|
|
|
88
|
-
export default AnnoToolSelector
|
|
95
|
+
export default AnnoToolSelector
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
CDropdown,
|
|
4
|
+
CDropdownMenu,
|
|
5
|
+
CDropdownItem,
|
|
6
|
+
CFormInput,
|
|
7
|
+
CDropdownDivider,
|
|
8
|
+
CDropdownToggle,
|
|
9
|
+
CTooltip,
|
|
10
|
+
} from '@coreui/react'
|
|
11
|
+
import { Label } from '../../../types'
|
|
12
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
13
|
+
import { faTag } from '@fortawesome/free-solid-svg-icons'
|
|
14
|
+
import { IconProps } from 'semantic-ui-react'
|
|
15
|
+
import TagLabel from './TagLabel'
|
|
16
|
+
|
|
17
|
+
type ImageLabelInputProps = {
|
|
18
|
+
isDisabled: boolean
|
|
19
|
+
isVisible: boolean
|
|
20
|
+
selectedLabelsIds: number[]
|
|
21
|
+
possibleLabels: Label[]
|
|
22
|
+
isMultilabel?: boolean
|
|
23
|
+
onLabelSelect: (selectedLabelIds: number[]) => void
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const ImageLabelInput = ({
|
|
27
|
+
isDisabled,
|
|
28
|
+
isVisible,
|
|
29
|
+
selectedLabelsIds,
|
|
30
|
+
possibleLabels,
|
|
31
|
+
isMultilabel = false,
|
|
32
|
+
onLabelSelect,
|
|
33
|
+
}: ImageLabelInputProps) => {
|
|
34
|
+
const [filter, setFilter] = useState('')
|
|
35
|
+
|
|
36
|
+
const filteredLabels: Label[] = possibleLabels.filter((label: Label) =>
|
|
37
|
+
label.name.toLowerCase().includes(filter.toLowerCase()),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
const updateSelectedLabels = (clickedLabel: Label) => {
|
|
41
|
+
let newLabelIds: number[] = []
|
|
42
|
+
|
|
43
|
+
if (isMultilabel) {
|
|
44
|
+
newLabelIds = [...selectedLabelsIds]
|
|
45
|
+
// check if item in list (get its index if so)
|
|
46
|
+
const foundIndex: number = selectedLabelsIds.indexOf(clickedLabel.id)
|
|
47
|
+
// add label if not in list, remove label if in list
|
|
48
|
+
if (foundIndex === -1) {
|
|
49
|
+
newLabelIds.push(clickedLabel.id)
|
|
50
|
+
} else {
|
|
51
|
+
newLabelIds.splice(foundIndex, 1)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// single-label: just replace list with clicked item
|
|
55
|
+
else newLabelIds = [clickedLabel.id]
|
|
56
|
+
|
|
57
|
+
onLabelSelect(newLabelIds)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const getSelectedLabels = () => {
|
|
61
|
+
const selectedLabels: Label[] = possibleLabels.filter((label: Label) =>
|
|
62
|
+
selectedLabelsIds.includes(label.id),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
return selectedLabels
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const renderLabels = () => {
|
|
69
|
+
if (selectedLabelsIds.length === 0)
|
|
70
|
+
return (
|
|
71
|
+
<div style={{ marginTop: 6 }}>
|
|
72
|
+
<FontAwesomeIcon icon={faTag as IconProps} />
|
|
73
|
+
</div>
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
const selectedLabels = getSelectedLabels()
|
|
77
|
+
return selectedLabels.map((label: Label) => (
|
|
78
|
+
<TagLabel
|
|
79
|
+
key={label.name}
|
|
80
|
+
name={label.name}
|
|
81
|
+
color={label.color}
|
|
82
|
+
size={25}
|
|
83
|
+
triangleSize={17}
|
|
84
|
+
style={{ marginLeft: 1, marginTop: 5 }}
|
|
85
|
+
/>
|
|
86
|
+
))
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<CTooltip content="Add Image Label">
|
|
91
|
+
<CDropdown visible={isVisible} autoClose={false}>
|
|
92
|
+
{/* this invisible toggle has to be here, othervise the menu is not showing as intended */}
|
|
93
|
+
<CDropdownToggle
|
|
94
|
+
variant="outline"
|
|
95
|
+
caret={false}
|
|
96
|
+
color={isDisabled ? 'secondary' : 'primary'}
|
|
97
|
+
style={{ paddingTop: 0, paddingBottom: 0 }}
|
|
98
|
+
as="div"
|
|
99
|
+
>
|
|
100
|
+
{renderLabels()}
|
|
101
|
+
</CDropdownToggle>
|
|
102
|
+
<CDropdownMenu>
|
|
103
|
+
<div className="px-3 py-2">
|
|
104
|
+
<CFormInput
|
|
105
|
+
placeholder="Filter label..."
|
|
106
|
+
value={filter}
|
|
107
|
+
onChange={(e) => setFilter(e.target.value)}
|
|
108
|
+
autoFocus
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
111
|
+
<CDropdownDivider />
|
|
112
|
+
{filteredLabels.length > 0 ? (
|
|
113
|
+
filteredLabels.map((label: Label) => (
|
|
114
|
+
<CDropdownItem key={label.id} onClick={() => updateSelectedLabels(label)}>
|
|
115
|
+
{label.name}
|
|
116
|
+
</CDropdownItem>
|
|
117
|
+
))
|
|
118
|
+
) : (
|
|
119
|
+
<CDropdownItem disabled>No results</CDropdownItem>
|
|
120
|
+
)}
|
|
121
|
+
</CDropdownMenu>
|
|
122
|
+
</CDropdown>
|
|
123
|
+
</CTooltip>
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export default ImageLabelInput
|
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { CSSProperties } from 'react'
|
|
2
2
|
|
|
3
3
|
type TagLabelProps = {
|
|
4
|
-
name: string
|
|
5
|
-
color?: string
|
|
6
|
-
size?: number
|
|
7
|
-
style?:
|
|
8
|
-
triangleSize?: number
|
|
9
|
-
onClick?: () => void
|
|
10
|
-
}
|
|
4
|
+
name: string
|
|
5
|
+
color?: string
|
|
6
|
+
size?: number
|
|
7
|
+
style?: CSSProperties
|
|
8
|
+
triangleSize?: number
|
|
9
|
+
onClick?: () => void
|
|
10
|
+
}
|
|
11
11
|
|
|
12
12
|
const TagLabel = ({
|
|
13
13
|
name,
|
|
14
|
-
color =
|
|
14
|
+
color = '#2185d0',
|
|
15
15
|
size: bodySize = 32,
|
|
16
16
|
style = {},
|
|
17
17
|
triangleSize = 22,
|
|
18
18
|
onClick,
|
|
19
19
|
}: TagLabelProps) => {
|
|
20
|
-
const containerStyle = {
|
|
21
|
-
display:
|
|
22
|
-
alignItems:
|
|
20
|
+
const containerStyle: CSSProperties = {
|
|
21
|
+
display: 'inline-flex',
|
|
22
|
+
alignItems: 'center',
|
|
23
23
|
backgroundColor: color,
|
|
24
|
-
color:
|
|
24
|
+
color: '#000',
|
|
25
25
|
height: `${bodySize}px`,
|
|
26
26
|
fontSize: `${bodySize * 0.45}px`,
|
|
27
27
|
padding: `0 1rem 0 0.75rem`,
|
|
28
|
-
|
|
28
|
+
border: 0,
|
|
29
|
+
borderRadius: '0 0.25rem 0.25rem 0',
|
|
29
30
|
marginLeft: `${triangleSize / 1.4}px`, // hypothenuse of the halfed square
|
|
30
|
-
position:
|
|
31
|
-
overflow:
|
|
32
|
-
cursor: onClick ?
|
|
31
|
+
position: 'relative',
|
|
32
|
+
overflow: 'visible', // allow triangle to stick out
|
|
33
|
+
cursor: onClick ? 'pointer' : 'default',
|
|
33
34
|
...style,
|
|
34
|
-
}
|
|
35
|
+
}
|
|
35
36
|
|
|
36
37
|
// A rotated square to simulate a triangle
|
|
37
|
-
const triangleStyle = {
|
|
38
|
-
position:
|
|
38
|
+
const triangleStyle: CSSProperties = {
|
|
39
|
+
position: 'absolute',
|
|
39
40
|
left: `-${triangleSize / 2}px`,
|
|
40
41
|
width: `${triangleSize}px`,
|
|
41
42
|
height: `${triangleSize}px`,
|
|
42
43
|
backgroundColor: color,
|
|
43
|
-
transform:
|
|
44
|
+
transform: 'rotate(45deg)',
|
|
44
45
|
zIndex: -1, // push behind text
|
|
45
|
-
pointerEvents:
|
|
46
|
-
}
|
|
46
|
+
pointerEvents: 'none',
|
|
47
|
+
}
|
|
47
48
|
|
|
48
49
|
return (
|
|
49
|
-
<
|
|
50
|
+
<button style={containerStyle} onClick={onClick}>
|
|
50
51
|
<span style={triangleStyle} />
|
|
51
52
|
{name}
|
|
52
|
-
</
|
|
53
|
-
)
|
|
54
|
-
}
|
|
53
|
+
</button>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
55
56
|
|
|
56
|
-
export default TagLabel
|
|
57
|
+
export default TagLabel
|
|
@@ -1,63 +1,66 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { faBan
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { CButtonGroup } from '@coreui/react'
|
|
2
|
+
import { faBan } from '@fortawesome/free-solid-svg-icons'
|
|
3
|
+
import { useEffect, useState } from 'react'
|
|
4
|
+
import { Label } from '../../types'
|
|
5
|
+
import ImageLabelInput from './ImageToolItems/ImageLabelInput'
|
|
6
|
+
import IconButton from '../../IconButton'
|
|
7
7
|
|
|
8
8
|
type ImageToolsProps = {
|
|
9
|
-
canJunk: boolean
|
|
10
|
-
imageLabelIds?: number[]
|
|
11
|
-
isDisabled?: boolean
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
canJunk: boolean
|
|
10
|
+
imageLabelIds?: number[]
|
|
11
|
+
isDisabled?: boolean
|
|
12
|
+
isFullscreen?: boolean
|
|
13
|
+
isImageJunk?: boolean
|
|
14
|
+
possibleLabels: Label[]
|
|
15
|
+
onImageLabelsChanged?: (selectedImageIds: number[]) => void
|
|
16
|
+
onSetIsImageJunk?: (isImageJunk: boolean) => void
|
|
17
|
+
}
|
|
17
18
|
|
|
18
19
|
const ImageTools = ({
|
|
19
20
|
canJunk,
|
|
20
21
|
isDisabled = false,
|
|
22
|
+
isFullscreen = false,
|
|
21
23
|
isImageJunk = false,
|
|
22
24
|
imageLabelIds = [],
|
|
23
25
|
possibleLabels,
|
|
24
26
|
onImageLabelsChanged = () => {},
|
|
25
27
|
onSetIsImageJunk = () => {},
|
|
26
28
|
}: ImageToolsProps) => {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
const [isLabelPopupVisible, setIsLabelPopupVisible] = useState<boolean>(false)
|
|
30
|
+
|
|
31
|
+
// close modal when the fullscreen state changes
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
setIsLabelPopupVisible(false)
|
|
34
|
+
}, [isFullscreen])
|
|
30
35
|
|
|
31
36
|
return (
|
|
32
37
|
<CButtonGroup role="group" aria-label="Image Tools">
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
</CButton>
|
|
47
|
-
</CPopover>
|
|
38
|
+
{possibleLabels && (
|
|
39
|
+
<ImageLabelInput
|
|
40
|
+
isDisabled={isDisabled}
|
|
41
|
+
isMultilabel={true}
|
|
42
|
+
isVisible={isLabelPopupVisible}
|
|
43
|
+
selectedLabelsIds={imageLabelIds}
|
|
44
|
+
possibleLabels={possibleLabels}
|
|
45
|
+
onLabelSelect={(selectedLabelIds: number[]) => {
|
|
46
|
+
setIsLabelPopupVisible(false)
|
|
47
|
+
onImageLabelsChanged(selectedLabelIds)
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
)}
|
|
48
51
|
|
|
49
52
|
{canJunk && (
|
|
50
|
-
<
|
|
53
|
+
<IconButton
|
|
51
54
|
color="primary"
|
|
52
|
-
|
|
55
|
+
icon={faBan}
|
|
56
|
+
isOutline={!isImageJunk}
|
|
53
57
|
disabled={isDisabled}
|
|
54
58
|
onClick={() => onSetIsImageJunk(!isImageJunk)}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
</CButton>
|
|
59
|
+
tooltip="Junk image"
|
|
60
|
+
/>
|
|
58
61
|
)}
|
|
59
62
|
</CButtonGroup>
|
|
60
|
-
)
|
|
61
|
-
}
|
|
63
|
+
)
|
|
64
|
+
}
|
|
62
65
|
|
|
63
|
-
export default ImageTools
|
|
66
|
+
export default ImageTools
|
|
@@ -6,101 +6,98 @@ import {
|
|
|
6
6
|
CCol,
|
|
7
7
|
CContainer,
|
|
8
8
|
CRow,
|
|
9
|
-
} from
|
|
9
|
+
} from '@coreui/react'
|
|
10
10
|
|
|
11
11
|
type Instruction = {
|
|
12
|
-
title: string
|
|
13
|
-
description: string[]
|
|
14
|
-
}
|
|
12
|
+
title: string
|
|
13
|
+
description: string[]
|
|
14
|
+
}
|
|
15
15
|
|
|
16
16
|
const Instructions = () => {
|
|
17
17
|
const instructionContent: Instruction[] = [
|
|
18
18
|
{
|
|
19
|
-
title:
|
|
19
|
+
title: 'How to draw?',
|
|
20
20
|
description: [
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
'1.) Select a Tool in the toolbar',
|
|
22
|
+
'2.) Draw with RIGHT CLICK on Canvas',
|
|
23
23
|
],
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
title:
|
|
26
|
+
title: 'How to delete an annotation?',
|
|
27
27
|
description: [
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
'1.) Select an annotation with LEFT CLICK',
|
|
29
|
+
'2.) Press DELETE or BACKSPACE',
|
|
30
30
|
],
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
|
-
title:
|
|
33
|
+
title: 'How to assign a label?',
|
|
34
34
|
description: [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
'1.) Select an annotation with LEFT CLICK ',
|
|
36
|
+
'2.) Hit ENTER ',
|
|
37
|
+
'3.) Type into the input field ',
|
|
38
|
+
'4.) Hit ENTER to confirm ',
|
|
39
|
+
'5.) Hit ESCAPE to close the input field',
|
|
40
40
|
],
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
|
-
title:
|
|
44
|
-
description: [
|
|
43
|
+
title: 'Undo/ Redo',
|
|
44
|
+
description: ['Undo: Hit STRG + Z ', 'Redo: Hit STRG + R'],
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
|
-
title:
|
|
47
|
+
title: 'Add/ Remove a node to Line/Polygon',
|
|
48
48
|
description: [
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
'Add: Hit STRG + Click left on the line',
|
|
50
|
+
'Remove: Hit STRG + Click left on the node to delete',
|
|
51
51
|
],
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
|
-
title:
|
|
55
|
-
description: [
|
|
54
|
+
title: 'Remove a node',
|
|
55
|
+
description: ['Hold CTRL and left click on the node'],
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
|
-
title:
|
|
58
|
+
title: 'Edit Line/Polygon',
|
|
59
59
|
description: [
|
|
60
|
-
|
|
60
|
+
'1.) Click on the Annotation you want to edit.',
|
|
61
61
|
' 2.) Press "e". New nodes can now be added using right click',
|
|
62
62
|
],
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
|
-
title:
|
|
65
|
+
title: 'Zoom/ Move Canvas',
|
|
66
66
|
description: [
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
'Zoom: Use MOUSE WHEEL to zoom in/out',
|
|
68
|
+
'Move: Hold MOUSE WHEEL and move mouse. Or Use W/A/S/D keys to move camera up/left/down/right',
|
|
69
69
|
],
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
|
-
title:
|
|
73
|
-
description: [
|
|
72
|
+
title: 'TAB navigation',
|
|
73
|
+
description: ['You can traverse all visible annotation by hitting TAB.'],
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
|
-
title:
|
|
76
|
+
title: 'Next/Prev image navigation',
|
|
77
77
|
description: [
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
'Get next image by hitting ARROW_RIGHT key.',
|
|
79
|
+
'Get previous image by hitting ARROW_LEFT key.',
|
|
80
80
|
],
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
|
-
title:
|
|
84
|
-
description: [
|
|
85
|
-
"Copy: 1.) Select annotation 2.) Hit STRG + C",
|
|
86
|
-
"Paste: STRG + V",
|
|
87
|
-
],
|
|
83
|
+
title: 'Copy and Paste annotations',
|
|
84
|
+
description: ['Copy: 1.) Select annotation 2.) Hit STRG + C', 'Paste: STRG + V'],
|
|
88
85
|
},
|
|
89
86
|
{
|
|
90
|
-
title:
|
|
91
|
-
description: [
|
|
87
|
+
title: 'Mark image as junk',
|
|
88
|
+
description: ['Press J key'],
|
|
92
89
|
},
|
|
93
90
|
{
|
|
94
|
-
title:
|
|
95
|
-
description: [
|
|
91
|
+
title: 'Assign a comment to a 2D annoation',
|
|
92
|
+
description: ['1.) Select annotation', '2.) Hit C key'],
|
|
96
93
|
},
|
|
97
|
-
]
|
|
94
|
+
]
|
|
98
95
|
|
|
99
96
|
const renderCards = () => {
|
|
100
97
|
return instructionContent.map((instruction) => {
|
|
101
98
|
const stepsContent = instruction.description.map((step) => (
|
|
102
99
|
<CCardText key={step}>{step}</CCardText>
|
|
103
|
-
))
|
|
100
|
+
))
|
|
104
101
|
return (
|
|
105
102
|
<CCol xs={12} md={4} lg={3} key={instruction.title}>
|
|
106
103
|
<CCard>
|
|
@@ -110,15 +107,15 @@ const Instructions = () => {
|
|
|
110
107
|
</CCardBody>
|
|
111
108
|
</CCard>
|
|
112
109
|
</CCol>
|
|
113
|
-
)
|
|
114
|
-
})
|
|
115
|
-
}
|
|
110
|
+
)
|
|
111
|
+
})
|
|
112
|
+
}
|
|
116
113
|
|
|
117
114
|
return (
|
|
118
115
|
<CContainer>
|
|
119
116
|
<CRow xs={{ gutterY: 2 }}>{renderCards()}</CRow>
|
|
120
117
|
</CContainer>
|
|
121
|
-
)
|
|
122
|
-
}
|
|
118
|
+
)
|
|
119
|
+
}
|
|
123
120
|
|
|
124
|
-
export default Instructions
|
|
121
|
+
export default Instructions
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { CModal, CModalBody, CModalHeader } from
|
|
2
|
-
import Instructions from
|
|
1
|
+
import { CModal, CModalBody, CModalHeader } from '@coreui/react'
|
|
2
|
+
import Instructions from './Instructions'
|
|
3
3
|
|
|
4
4
|
type InstructionsModalProps = {
|
|
5
|
-
isOpen: boolean
|
|
6
|
-
setIsOpen: (boolean) => void
|
|
7
|
-
}
|
|
5
|
+
isOpen: boolean
|
|
6
|
+
setIsOpen: (boolean) => void
|
|
7
|
+
}
|
|
8
8
|
|
|
9
9
|
const InstructionsModal = ({ isOpen, setIsOpen }: InstructionsModalProps) => {
|
|
10
10
|
return (
|
|
@@ -14,7 +14,7 @@ const InstructionsModal = ({ isOpen, setIsOpen }: InstructionsModalProps) => {
|
|
|
14
14
|
<Instructions />
|
|
15
15
|
</CModalBody>
|
|
16
16
|
</CModal>
|
|
17
|
-
)
|
|
18
|
-
}
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
19
|
|
|
20
|
-
export default InstructionsModal
|
|
20
|
+
export default InstructionsModal
|