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,23 +1,25 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from
|
|
2
|
-
import
|
|
3
|
-
import { fn } from
|
|
4
|
-
import LabelInput from
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import exampleLabels from './exampleData/exampleLabels'
|
|
3
|
+
import { fn } from '@storybook/test'
|
|
4
|
+
import LabelInput from '../Canvas/LabelInput'
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title:
|
|
7
|
+
title: 'Components/LabelFilter',
|
|
8
8
|
component: LabelInput,
|
|
9
9
|
argTypes: {},
|
|
10
10
|
parameters: {
|
|
11
|
-
layout:
|
|
11
|
+
layout: 'centered',
|
|
12
12
|
},
|
|
13
|
-
} satisfies Meta<typeof LabelInput
|
|
13
|
+
} satisfies Meta<typeof LabelInput>
|
|
14
14
|
|
|
15
|
-
export default meta
|
|
16
|
-
type Story = StoryObj<typeof meta
|
|
15
|
+
export default meta
|
|
16
|
+
type Story = StoryObj<typeof meta>
|
|
17
17
|
|
|
18
18
|
export const Default: Story = {
|
|
19
19
|
args: {
|
|
20
|
-
possibleLabels,
|
|
20
|
+
possibleLabels: exampleLabels.voc,
|
|
21
|
+
isVisible: true,
|
|
22
|
+
selectedLabelsIds: [],
|
|
21
23
|
onLabelSelect: fn(),
|
|
22
24
|
},
|
|
23
|
-
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Canvas, Meta, Source, Story } from '@storybook/addon-docs/blocks'
|
|
2
|
+
import * as SiaStories from './MinimalSia.stories.tsx'
|
|
3
|
+
|
|
4
|
+
<Meta of={SiaStories} />
|
|
5
|
+
|
|
6
|
+
# SIA Examples
|
|
7
|
+
|
|
8
|
+
Here we'll show you how to include SIA into your project!
|
|
9
|
+
|
|
10
|
+
## Minimal SIA
|
|
11
|
+
|
|
12
|
+
Including SIA in its minimal form is very simple: Just use the `Sia` component and give it an image and possible Labels as parameters:
|
|
13
|
+
|
|
14
|
+
<Source of={SiaStories.Minimal} language="tsx" />
|
|
15
|
+
|
|
16
|
+
This will get you the following:
|
|
17
|
+
|
|
18
|
+
<Canvas>
|
|
19
|
+
<Story of={SiaStories.Minimal} />
|
|
20
|
+
</Canvas>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
|
|
3
|
+
import Sia from '../Sia'
|
|
4
|
+
import type { Label } from '../types'
|
|
5
|
+
import exampleImage from './exampleData/exampleImage'
|
|
6
|
+
|
|
7
|
+
export const ActionsData = {}
|
|
8
|
+
|
|
9
|
+
const meta = {
|
|
10
|
+
title: 'Minimal SIA',
|
|
11
|
+
component: Sia,
|
|
12
|
+
parameters: {
|
|
13
|
+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
14
|
+
layout: 'fullscreen',
|
|
15
|
+
},
|
|
16
|
+
tags: ['!autodocs'],
|
|
17
|
+
excludeStories: /.*Data$/,
|
|
18
|
+
args: {
|
|
19
|
+
...ActionsData,
|
|
20
|
+
},
|
|
21
|
+
decorators: [
|
|
22
|
+
(Story) => (
|
|
23
|
+
<div
|
|
24
|
+
style={{
|
|
25
|
+
height: '65vh',
|
|
26
|
+
padding: 10,
|
|
27
|
+
overflow: 'hidden',
|
|
28
|
+
display: 'flex',
|
|
29
|
+
flexDirection: 'column',
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
<Story />
|
|
33
|
+
</div>
|
|
34
|
+
),
|
|
35
|
+
],
|
|
36
|
+
} satisfies Meta<typeof Sia>
|
|
37
|
+
|
|
38
|
+
export default meta
|
|
39
|
+
type Story = StoryObj<typeof meta>
|
|
40
|
+
|
|
41
|
+
const minimalExampleLabels: Label[] = [
|
|
42
|
+
{
|
|
43
|
+
id: 1,
|
|
44
|
+
name: 'Cat',
|
|
45
|
+
description: 'Includes all cats',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 2,
|
|
49
|
+
name: 'Dog',
|
|
50
|
+
description: 'Includes all dogs',
|
|
51
|
+
},
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Minimal SIA example
|
|
56
|
+
*/
|
|
57
|
+
export const Minimal: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
...ActionsData,
|
|
60
|
+
image: exampleImage,
|
|
61
|
+
possibleLabels: minimalExampleLabels,
|
|
62
|
+
},
|
|
63
|
+
parameters: {
|
|
64
|
+
docs: {
|
|
65
|
+
source: {
|
|
66
|
+
code: `
|
|
67
|
+
const imageBlob: string = "data:image/jpeg;base64,/9j/4AAQSkZ..."
|
|
68
|
+
const possibleLabels: Label = [
|
|
69
|
+
{
|
|
70
|
+
id: 1,
|
|
71
|
+
name: "Cat",
|
|
72
|
+
description: "Includes all cats",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 2,
|
|
76
|
+
name: "Dog",
|
|
77
|
+
description: "Includes all dogs",
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
...
|
|
82
|
+
|
|
83
|
+
<Sia
|
|
84
|
+
image={imageBlob}
|
|
85
|
+
possibleLabels={possibleLabels}
|
|
86
|
+
/>`,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
|
|
3
|
+
import DemoWrapper from './DemoWrapper'
|
|
4
|
+
import { AnnotationSettings } from '../../types'
|
|
5
|
+
import exampleExternalAnnotations from '../exampleData/exampleExternalAnnotations'
|
|
6
|
+
|
|
7
|
+
export const ActionsData = {}
|
|
8
|
+
|
|
9
|
+
const meta = {
|
|
10
|
+
title: 'Components/DemoWrapper',
|
|
11
|
+
component: DemoWrapper,
|
|
12
|
+
parameters: {
|
|
13
|
+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
14
|
+
layout: 'fullscreen',
|
|
15
|
+
},
|
|
16
|
+
tags: ['!autodocs'],
|
|
17
|
+
excludeStories: /.*Data$/,
|
|
18
|
+
args: {
|
|
19
|
+
...ActionsData,
|
|
20
|
+
},
|
|
21
|
+
} satisfies Meta<typeof DemoWrapper>
|
|
22
|
+
|
|
23
|
+
export default meta
|
|
24
|
+
type Story = StoryObj<typeof meta>
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* SIA with dummy data
|
|
28
|
+
*/
|
|
29
|
+
export const Default: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
...ActionsData,
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const annotationSettings: AnnotationSettings = {
|
|
36
|
+
canCreate: true,
|
|
37
|
+
canHaveMultipleLabels: true,
|
|
38
|
+
canLabel: true,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const WithPolygonAnnotations: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
...ActionsData,
|
|
44
|
+
annotations: exampleExternalAnnotations.polygon,
|
|
45
|
+
annotationSettings,
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const WithBBoxAnnotations: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
...ActionsData,
|
|
52
|
+
annotations: exampleExternalAnnotations.bbox,
|
|
53
|
+
annotationSettings,
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const WithLineAnnotations: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
...ActionsData,
|
|
60
|
+
annotations: exampleExternalAnnotations.line,
|
|
61
|
+
annotationSettings,
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const WithPointAnnotations: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
...ActionsData,
|
|
68
|
+
annotations: exampleExternalAnnotations.point,
|
|
69
|
+
annotationSettings,
|
|
70
|
+
},
|
|
71
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import Annotation from '../../Annotation/logic/Annotation'
|
|
2
|
+
import AnnotationTool from '../../models/AnnotationTool'
|
|
3
|
+
|
|
4
|
+
import Sia from '../../Sia'
|
|
5
|
+
|
|
6
|
+
import type { AnnotationSettings, ExternalAnnotation, UiConfig } from '../../types'
|
|
7
|
+
import exampleLabels from '../exampleData/exampleLabels'
|
|
8
|
+
import exampleImage from '../exampleData/exampleImage'
|
|
9
|
+
|
|
10
|
+
type DemoWrapperProps = {
|
|
11
|
+
annotations?: ExternalAnnotation[]
|
|
12
|
+
annotationSettings?: AnnotationSettings
|
|
13
|
+
isLoading?: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const DemoWrapper = ({
|
|
17
|
+
annotations = [],
|
|
18
|
+
annotationSettings,
|
|
19
|
+
isLoading = false,
|
|
20
|
+
}: DemoWrapperProps) => {
|
|
21
|
+
const uiConfig: UiConfig = {
|
|
22
|
+
nodeRadius: 4,
|
|
23
|
+
strokeWidth: 4,
|
|
24
|
+
imageCentered: false,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Sia
|
|
29
|
+
annotationSettings={annotationSettings}
|
|
30
|
+
initialAnnotations={annotations}
|
|
31
|
+
isLoading={isLoading}
|
|
32
|
+
possibleLabels={exampleLabels.voc}
|
|
33
|
+
uiConfig={uiConfig}
|
|
34
|
+
image={exampleImage}
|
|
35
|
+
defaultAnnotationTool={AnnotationTool.Polygon}
|
|
36
|
+
onAnnoCreated={(anno: Annotation, _: Annotation[]) => {
|
|
37
|
+
console.log('CREATED', anno)
|
|
38
|
+
}}
|
|
39
|
+
onAnnoCreationFinished={(anno: Annotation, _: Annotation[]) => {
|
|
40
|
+
console.log('FINISHED CREATION', anno)
|
|
41
|
+
}}
|
|
42
|
+
onAnnoChanged={(anno: Annotation, _: Annotation[]) => {
|
|
43
|
+
console.log('CHANGED', anno)
|
|
44
|
+
}}
|
|
45
|
+
onAnnoDeleted={(anno: Annotation, annos: Annotation[]) => {
|
|
46
|
+
console.log('DELETED', anno, annos)
|
|
47
|
+
}}
|
|
48
|
+
onImageLabelsChanged={(imageLabelIds: number[]) => {
|
|
49
|
+
console.log('IMAGE LABEL IDS CHANGED', imageLabelIds)
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default DemoWrapper
|
|
@@ -1,65 +1,99 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from
|
|
2
|
-
import { fn } from "@storybook/test";
|
|
3
|
-
import {
|
|
4
|
-
canvasConfig,
|
|
5
|
-
filter,
|
|
6
|
-
selectedTool,
|
|
7
|
-
imgMeta,
|
|
8
|
-
toolbarEnabled,
|
|
9
|
-
annos,
|
|
10
|
-
possibleLabels,
|
|
11
|
-
imgBlob,
|
|
12
|
-
noAnnos,
|
|
13
|
-
} from "../siaDummyData";
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
14
2
|
|
|
15
|
-
import Sia from
|
|
3
|
+
import Sia from '../../Sia'
|
|
16
4
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
onCanvasEvent: fn(),
|
|
24
|
-
onToolBarEvent: fn(),
|
|
25
|
-
onGetFunction: fn(),
|
|
26
|
-
};
|
|
5
|
+
import { UiConfig } from '../../types'
|
|
6
|
+
|
|
7
|
+
import exampleImage from '../exampleData/exampleImage'
|
|
8
|
+
import exampleLabels from '../exampleData/exampleLabels'
|
|
9
|
+
|
|
10
|
+
export const ActionsData = {}
|
|
27
11
|
|
|
28
12
|
const meta = {
|
|
29
|
-
title:
|
|
13
|
+
title: 'Components/Sia',
|
|
30
14
|
component: Sia,
|
|
31
15
|
parameters: {
|
|
32
16
|
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
33
|
-
layout:
|
|
17
|
+
layout: 'fullscreen',
|
|
34
18
|
},
|
|
35
|
-
tags: [
|
|
19
|
+
tags: ['!autodocs'],
|
|
36
20
|
excludeStories: /.*Data$/,
|
|
37
21
|
args: {
|
|
38
22
|
...ActionsData,
|
|
39
23
|
},
|
|
40
|
-
|
|
24
|
+
decorators: [(Story) => <Story />],
|
|
25
|
+
} satisfies Meta<typeof Sia>
|
|
26
|
+
|
|
27
|
+
export default meta
|
|
28
|
+
type Story = StoryObj<typeof meta>
|
|
41
29
|
|
|
42
|
-
|
|
43
|
-
|
|
30
|
+
const uiConfig: UiConfig = {
|
|
31
|
+
nodeRadius: 4,
|
|
32
|
+
strokeWidth: 4,
|
|
33
|
+
imageCentered: false,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const defaultArgs = {
|
|
37
|
+
...ActionsData,
|
|
38
|
+
uiConfig,
|
|
39
|
+
image: exampleImage,
|
|
40
|
+
possibleLabels: exampleLabels.voc,
|
|
41
|
+
}
|
|
44
42
|
|
|
45
43
|
/**
|
|
46
44
|
* SIA with dummy data
|
|
47
45
|
*/
|
|
48
46
|
export const Default: Story = {
|
|
47
|
+
args: defaultArgs,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Minimal SIA example
|
|
52
|
+
*/
|
|
53
|
+
export const Minimal: Story = {
|
|
49
54
|
args: {
|
|
50
|
-
...
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
...defaultArgs,
|
|
56
|
+
possibleLabels: exampleLabels.minimal,
|
|
57
|
+
},
|
|
58
|
+
parameters: {
|
|
59
|
+
docs: {
|
|
60
|
+
source: {
|
|
61
|
+
code: `
|
|
62
|
+
const imageBlob: string = "data:image/jpeg;base64,/9j/4AAQSkZ..."
|
|
63
|
+
const possibleLabels: Label = [
|
|
64
|
+
{
|
|
65
|
+
id: 1,
|
|
66
|
+
name: "Cat",
|
|
67
|
+
description: "Includes all cats",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: 2,
|
|
71
|
+
name: "Dog",
|
|
72
|
+
description: "Includes all dogs",
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
...
|
|
77
|
+
|
|
78
|
+
<Sia
|
|
79
|
+
image={imageBlob}
|
|
80
|
+
possibleLabels={possibleLabels}
|
|
81
|
+
/>`,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const Loading: Story = {
|
|
88
|
+
args: {
|
|
89
|
+
...defaultArgs,
|
|
90
|
+
isLoading: true,
|
|
91
|
+
},
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const Junk: Story = {
|
|
95
|
+
args: {
|
|
96
|
+
...defaultArgs,
|
|
97
|
+
initialIsImageJunk: true,
|
|
64
98
|
},
|
|
65
|
-
}
|
|
99
|
+
}
|
|
@@ -1,32 +1,31 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import TagLabel from "../../../Toolbar/ToolbarItems/ImageToolItems/TagLabel";
|
|
3
|
+
import TagLabel from '../../../Toolbar/ToolbarItems/ImageToolItems/TagLabel'
|
|
5
4
|
|
|
6
5
|
const meta = {
|
|
7
|
-
title:
|
|
6
|
+
title: 'Components/Toolbar/TagLabel',
|
|
8
7
|
component: TagLabel,
|
|
9
8
|
argTypes: {},
|
|
10
9
|
parameters: {
|
|
11
|
-
layout:
|
|
10
|
+
layout: 'centered',
|
|
12
11
|
},
|
|
13
|
-
} satisfies Meta<typeof TagLabel
|
|
12
|
+
} satisfies Meta<typeof TagLabel>
|
|
14
13
|
|
|
15
|
-
export default meta
|
|
16
|
-
type Story = StoryObj<typeof meta
|
|
14
|
+
export default meta
|
|
15
|
+
type Story = StoryObj<typeof meta>
|
|
17
16
|
|
|
18
17
|
export const Default: Story = {
|
|
19
18
|
args: {
|
|
20
19
|
name: "I'm a label",
|
|
21
20
|
},
|
|
22
|
-
}
|
|
21
|
+
}
|
|
23
22
|
|
|
24
23
|
export const DifferentColor: Story = {
|
|
25
24
|
args: {
|
|
26
25
|
name: "I'm green",
|
|
27
|
-
color:
|
|
26
|
+
color: '#2ecc71',
|
|
28
27
|
},
|
|
29
|
-
}
|
|
28
|
+
}
|
|
30
29
|
|
|
31
30
|
export const DifferentSize: Story = {
|
|
32
31
|
args: {
|
|
@@ -34,4 +33,4 @@ export const DifferentSize: Story = {
|
|
|
34
33
|
size: 200,
|
|
35
34
|
triangleSize: 142,
|
|
36
35
|
},
|
|
37
|
-
}
|
|
36
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
2
|
|
|
3
|
-
import Toolbar from
|
|
4
|
-
import
|
|
5
|
-
import Instructions from
|
|
3
|
+
import Toolbar from '../../Toolbar/Toolbar'
|
|
4
|
+
import '../main.scss'
|
|
5
|
+
import Instructions from '../../Toolbar/ToolbarItems/Instructions'
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
8
|
-
title:
|
|
8
|
+
title: 'Components/Toolbar/Instructions',
|
|
9
9
|
component: Instructions,
|
|
10
10
|
parameters: {
|
|
11
|
-
layout:
|
|
11
|
+
layout: 'centered',
|
|
12
12
|
},
|
|
13
|
-
} satisfies Meta<typeof Toolbar
|
|
13
|
+
} satisfies Meta<typeof Toolbar>
|
|
14
14
|
|
|
15
|
-
export default meta
|
|
16
|
-
type Story = StoryObj<typeof meta
|
|
15
|
+
export default meta
|
|
16
|
+
type Story = StoryObj<typeof meta>
|
|
17
17
|
|
|
18
|
-
const defaultArgs = {}
|
|
18
|
+
const defaultArgs = {}
|
|
19
19
|
|
|
20
20
|
export const Default: Story = {
|
|
21
21
|
args: defaultArgs,
|
|
22
|
-
}
|
|
22
|
+
}
|
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import AnnotationSettings from "../../models/AnnotationSettings";
|
|
10
|
-
import { possibleLabels } from "../siaDummyData2";
|
|
3
|
+
import Toolbar from '../../Toolbar/Toolbar'
|
|
4
|
+
import '../main.scss'
|
|
5
|
+
import AnnotationTool from '../../models/AnnotationTool'
|
|
6
|
+
|
|
7
|
+
import { AllowedTools, AnnotationSettings } from '../../types'
|
|
8
|
+
import exampleLabels from '../exampleData/exampleLabels'
|
|
11
9
|
|
|
12
10
|
const meta = {
|
|
13
|
-
title:
|
|
11
|
+
title: 'Components/Toolbar',
|
|
14
12
|
component: Toolbar,
|
|
15
13
|
argTypes: {
|
|
16
|
-
|
|
17
|
-
control:
|
|
18
|
-
options:
|
|
14
|
+
selectedTool: {
|
|
15
|
+
control: 'select',
|
|
16
|
+
options: [
|
|
17
|
+
AnnotationTool.BBox,
|
|
18
|
+
AnnotationTool.Line,
|
|
19
|
+
AnnotationTool.Point,
|
|
20
|
+
AnnotationTool.Polygon,
|
|
21
|
+
],
|
|
19
22
|
},
|
|
20
23
|
},
|
|
21
24
|
parameters: {
|
|
22
|
-
layout:
|
|
25
|
+
layout: 'centered',
|
|
23
26
|
},
|
|
24
|
-
} satisfies Meta<typeof Toolbar
|
|
27
|
+
} satisfies Meta<typeof Toolbar>
|
|
25
28
|
|
|
26
|
-
export default meta
|
|
27
|
-
type Story = StoryObj<typeof meta
|
|
29
|
+
export default meta
|
|
30
|
+
type Story = StoryObj<typeof meta>
|
|
28
31
|
|
|
29
32
|
const allowedTools: AllowedTools = {
|
|
30
33
|
bbox: true,
|
|
@@ -32,25 +35,7 @@ const allowedTools: AllowedTools = {
|
|
|
32
35
|
line: true,
|
|
33
36
|
point: true,
|
|
34
37
|
polygon: true,
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// export default {
|
|
38
|
-
// title: "Components/Toolbar",
|
|
39
|
-
// component: Toolbar,
|
|
40
|
-
// parameters: {
|
|
41
|
-
// // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
42
|
-
// layout: "centered",
|
|
43
|
-
// },
|
|
44
|
-
// tags: ["autodocs"],
|
|
45
|
-
// args: {},
|
|
46
|
-
// argTypes: {
|
|
47
|
-
// defaultTool: {
|
|
48
|
-
// control: "select",
|
|
49
|
-
// options: AnnotationTool,
|
|
50
|
-
// description: "Select the right annotation tool",
|
|
51
|
-
// },
|
|
52
|
-
// },
|
|
53
|
-
// };
|
|
38
|
+
}
|
|
54
39
|
|
|
55
40
|
const limitedAllowedTools: AllowedTools = {
|
|
56
41
|
bbox: true,
|
|
@@ -58,44 +43,44 @@ const limitedAllowedTools: AllowedTools = {
|
|
|
58
43
|
line: false,
|
|
59
44
|
point: false,
|
|
60
45
|
polygon: false,
|
|
61
|
-
}
|
|
46
|
+
}
|
|
62
47
|
|
|
63
48
|
const annotationSettings: AnnotationSettings = {
|
|
64
49
|
canCreate: true,
|
|
65
50
|
canEdit: true,
|
|
66
51
|
canHaveMultipleLabels: true,
|
|
67
52
|
canLabel: true,
|
|
68
|
-
}
|
|
53
|
+
}
|
|
69
54
|
|
|
70
55
|
const defaultArgs = {
|
|
71
|
-
defaultTool: AnnotationTool.Line,
|
|
72
56
|
annotationSettings,
|
|
73
57
|
allowedTools,
|
|
74
|
-
possibleLabels,
|
|
75
|
-
|
|
58
|
+
possibleLabels: exampleLabels.voc,
|
|
59
|
+
selectedTool: AnnotationTool.BBox,
|
|
60
|
+
}
|
|
76
61
|
|
|
77
62
|
export const Default: Story = {
|
|
78
63
|
args: defaultArgs,
|
|
79
|
-
}
|
|
64
|
+
}
|
|
80
65
|
|
|
81
66
|
export const DifferentDefaultTool: Story = {
|
|
82
67
|
args: {
|
|
83
68
|
...defaultArgs,
|
|
84
|
-
|
|
69
|
+
selectedTool: AnnotationTool.Polygon,
|
|
85
70
|
},
|
|
86
|
-
}
|
|
71
|
+
}
|
|
87
72
|
|
|
88
73
|
export const LimitedAllowedTools: Story = {
|
|
89
74
|
args: {
|
|
90
75
|
...defaultArgs,
|
|
91
|
-
|
|
76
|
+
selectedTool: AnnotationTool.BBox,
|
|
92
77
|
allowedTools: limitedAllowedTools,
|
|
93
78
|
},
|
|
94
|
-
}
|
|
79
|
+
}
|
|
95
80
|
|
|
96
81
|
export const WithImageLabels: Story = {
|
|
97
82
|
args: {
|
|
98
83
|
...defaultArgs,
|
|
99
84
|
imageLabelIds: [2, 9],
|
|
100
85
|
},
|
|
101
|
-
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Welcome to LOST-SIAs documentation
|
|
2
|
+
|
|
3
|
+
SIA stands for "Single Image Annotation".
|
|
4
|
+
While its been heavily used inside [LOST](https://github.com/l3p-cv/lost), it is a standalone component that can be used individually.
|
|
5
|
+
This documentation presents common patterns how SIA can be used.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Coordinate Systems
|
|
2
|
+
|
|
3
|
+
SIA uses a scene-graph-like scheme for handling annotations.
|
|
4
|
+
Outside of SIA, every coordinate is normalized; it is a pair of values between 0 and 1 that represents the fraction of the image.
|
|
5
|
+
For example, the coordinate `{x: 0.5, y: 1}` would be in the bottom line and in the middle row of the image.
|
|
6
|
+
|
|
7
|
+
Inside the `Canvas` component, a different system is used: Instead of using the fraction, the Canvas uses the pixel values of the so-called stage.
|
|
8
|
+
|
|
9
|
+
## Stage handling
|
|
10
|
+
|
|
11
|
+
The stage is a compromise between the image and the available space for the canvas.
|
|
12
|
+
It represents the biggest possible scaling of the image that fits onto the canvas and can be made without affecting the aspect ratio of the image.
|
|
13
|
+
|
|
14
|
+

|
|
15
|
+
|
|
16
|
+
To convert the coordinates from the image into the stage coordinate system, each coordinate can be multiplied with the `imageToStageFactor`.
|
|
17
|
+
|
|
18
|
+
## Translations
|
|
19
|
+
|
|
20
|
+
The manual translations (when the user moved the image using wasd or the mouse) and the zoom are handled using the svg transform.
|
|
21
|
+
Therefore its not needed to translate the coordinates according to these modifications.
|
|
22
|
+
However, mouse events are not in relation to the stage or image but to the current page.
|
|
23
|
+
Because of this, the mouse coordinates need to be translated from the page coordinate system into the stage coordinate system by countering the svg transformations and applying the `pageToStageOffset`.
|
|
24
|
+
|
|
25
|
+

|