This repository was archived by the owner on Apr 18, 2024. It is now read-only.
Commit 18fc2e5
feat: DEV-4081: Implements Magic Wand tool for image segmentation (#1119)
* Rename floodfill tools to magic wand in preparation of work.
* Implements image segmentation Magic Wand.
This PR implements a Magic Wand, making it possible to click in a region of an image a user is doing segmentation labeling on, drag the mouse to dynamically change flood filling tolerance, then release the mouse button to get a new labeled area. It is particularly effective at labeling broad, diffuse, complex edged objects, such as clouds, cloud shadows, snow, etc. in earth observation applications or organic shapes in biomedical applications.
In-depth technical overview on how it works at the top of src/tools/MagicWand.js.
* Collapse multiple Magic Wand additions into the same class if appropriate.
* Remove console statement.
* Stack classes from successive Magic Wand thresholds when we are able to.
* Be able to collapse wand regions even if panning has happened.
* Remove spurious comments.
* Remove spurious console statement.
* Fix doc issue.
* Fix code line that got hidden by comment somehow.
* Double to single quotes to match new code style.
* Change protocol and storage bucket for Magic Wand example.
The old bucket was configured under the wrong project, and using https instead of http causes mixed content issues for CORS. Local development is done with http so using that.
* Whitespace fix.
* Capture undo/redoes and invalidate offscreen cache.
This means undo/redo will now work correctly, but will end up creating a new class layer if more magic wanding is done on the current instance.
* Put Magic Wand behind a feature flag (fflag_feat_front_dev_4081_magic_wand_tool).
* Fix path for feature flag file.
* Make the crossOrigin attribute more granular and flexible for different deployment scenarios.
* Remove listing the magic wand feature flag here.
* Magic Wand will be on in front end by default, but the server config will have it off by default.
Note that this is needed so that Magic Wand e2e integration tests will work.
* Whitespace fix.
* e2e integration tests for the Magic Wand.
* Lint fix -- remove unused import.
* Doc fix.
* Bring Brush tag in when Magicwand tag used, to deal with Eraser tool getting duplicated.
* Make sure the eraser shows up when just magicwand tag present.
To do this, we have to ensure that the eraser doesn't get added twice if the brush tag is also present.
* Make sure magicwand drafts are properly saved for autosave.
* Enable eraser integration tests now that this bug is fixed.
* Put duplicate tools panel logic behind magicwand feature flag as well.
* Fix incorrect import path.
* Make Magic Wand feature flag more dynamic, and tie into it for e2e teste.
* Code review feedback.
* Follow standard `node scripts/create-docs.js` flow.
Note that we have not been able to make sure the docs are generated correctly until the https://api.github.com/repos/heartexlabs/label-studio/contents/docs/source/tags API endpoint registers the magicwand tag.
* Fix docs so they are autogenerated correctly.
* Make code review feedback changes.
* Have the Brush be shown in the Magic Wand example as well.
* Lint and compilation fixes.
* Make Magic Wand thresholding more robust with better UX.
Basically, we now calculate the Magic Wand thresholding from the entire screen, not just relative to the image. We also correctly allow you to drag in any direction to get positive or negative thresholding.
* Ensure currently selected region still works when changing between some tools.
The Magic Wand, the Brush, and the Eraser should all retain selection when moving between them, as well as when moving between those tools and the Zoom or Pan tools.
This fix allows removing some hacky specific code I added for the Magic Wand for this behavior.
Fixes HumanSignal/label-studio#3510.
* Removed unused imports.
* Change path to Heartex AWS buckets.
* Make changes based on code review feedback.
* Add feature flags around unselect behavior.
* Fix region unselection for Selection, Erase & others
Erase previously had false, so it should not unselect region in any case.
Tools like Selection, Zoom and others should not unselect it as well.
So set default to false and added true to DrawingTool mixin.
* Temporarily disable gallery in e2e because of CORS
Currently tests are failing when image in gallery is switched.
These CORS errors can be fixed in separate PR, so had to disable it.
---------
Co-authored-by: Brad Neuberg <bradneuberg@planet.com>
Co-authored-by: Sergey Zhuk <sergey.zhuk@heartex.com>
Co-authored-by: hlomzik <hlomzik@gmail.com>
Co-authored-by: Nikita Belonogov <nikita.belonogov@heartex.com>1 parent f62c94d commit 18fc2e5
File tree
47 files changed
+36525
-187
lines changed- e2e
- fragments
- tests
- examples/image_magic_wand
- annotations
- images
- screenshots
- src
- assets/icons
- tools
- components
- ImageView
- Toolbar
- core
- feature-flags
- env
- mixins
- regions
- tags
- control
- object
- visual
- tools
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
47 files changed
+36525
-187
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
447 | 455 | | |
448 | 456 | | |
449 | 457 | | |
| |||
731 | 739 | | |
732 | 740 | | |
733 | 741 | | |
| 742 | + | |
734 | 743 | | |
735 | 744 | | |
736 | 745 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
0 commit comments