Skip to content

feat: BROS-87: Bitmask #7766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 56 commits into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
817ac78
Pixelwise
nick-skriabin Jun 14, 2025
8565525
Pixelwise tool
nick-skriabin Jun 14, 2025
8daa151
Pixelwise labels
nick-skriabin Jun 14, 2025
a125eb2
Pixel-wise drawing
nick-skriabin Jun 14, 2025
c2bdf16
Cleanup
nick-skriabin Jun 14, 2025
e336b6e
Merge branch 'develop' into fb-bros-87/pixel-precision-drawing
nick-skriabin Jun 14, 2025
845cf55
Persisting regions
nick-skriabin Jun 14, 2025
17d267c
Outline hover
nick-skriabin Jun 15, 2025
6af02aa
Remove unused packages
nick-skriabin Jun 15, 2025
bc689b9
Stability improvements
nick-skriabin Jun 16, 2025
488ea45
Pixel grid and eraser tool
nick-skriabin Jun 16, 2025
6732bed
Optimization
nick-skriabin Jun 16, 2025
8c3a9e7
Pixel grid overlay, cleanup
nick-skriabin Jun 16, 2025
41606fd
Outline generation stability
nick-skriabin Jun 16, 2025
24789b2
Mask loading stability
nick-skriabin Jun 16, 2025
39ef379
Fine-tune pixelwise region outline
nick-skriabin Jun 16, 2025
bcc96b5
Add pixelwise docs
nick-skriabin Jun 16, 2025
e9e51ae
Move pixelwise
nick-skriabin Jun 16, 2025
c421728
ci: Build tag docs
robot-ci-heartex Jun 16, 2025
46feaf9
Feature flag + scroll fix
nick-skriabin Jun 16, 2025
752bb85
Change highlighting behavior, fix begin drawing when selecting anothe…
nick-skriabin Jun 16, 2025
475ed5c
Fix pixel grid performance, fix drawing over other regions
nick-skriabin Jun 16, 2025
ae48fe1
Remove hover highlight
nick-skriabin Jun 16, 2025
c8109ee
PixelWise -> Bitmask
nick-skriabin Jun 16, 2025
774adbb
Feature flag and restore area
nick-skriabin Jun 16, 2025
722fb80
Restore registry
nick-skriabin Jun 16, 2025
2634706
Registry
nick-skriabin Jun 16, 2025
6f6d77b
Fix regions drawing
nick-skriabin Jun 16, 2025
b5214e1
Multi selection
nick-skriabin Jun 16, 2025
e49346f
Properly highlight regions when multi-selecting
nick-skriabin Jun 16, 2025
dd48e18
Region selection
nick-skriabin Jun 17, 2025
0ef6b75
Comments
nick-skriabin Jun 17, 2025
2d7a535
Undo history
nick-skriabin Jun 17, 2025
161fe73
Optimizations
nick-skriabin Jun 17, 2025
b042fb9
Optimize begin drawing lag
nick-skriabin Jun 17, 2025
d9228a1
Bitmask default stroke color
nick-skriabin Jun 17, 2025
9ffbf23
Add e2e test
nick-skriabin Jun 17, 2025
678e712
Cleanup
nick-skriabin Jun 17, 2025
8ef953c
Fix image grid misalignment
nick-skriabin Jun 18, 2025
5956183
Fix different misalignments between image and canvas
nick-skriabin Jun 18, 2025
613116c
Fix undo history
nick-skriabin Jun 18, 2025
49b3670
Labels on mask
nick-skriabin Jun 18, 2025
cb83bd2
Restore stage offset
nick-skriabin Jun 18, 2025
442ab33
Remove console
nick-skriabin Jun 18, 2025
8cec9d7
Rollback: unnecessary change
nick-skriabin Jun 18, 2025
7d5f92d
Rollback: unnecessary change
nick-skriabin Jun 18, 2025
ff1d694
Format biome
nick-skriabin Jun 18, 2025
6658f7c
Add tiny delays to make sure browser's there
nick-skriabin Jun 18, 2025
e6d74a0
Merge branch 'develop' into fb-bros-87/pixel-precision-drawing
nick-skriabin Jun 18, 2025
fc430a9
Fix performance degradation when creating a new region in Chrome
nick-skriabin Jun 18, 2025
79dcf50
Fix data loss on draft save
nick-skriabin Jun 18, 2025
4c15aa9
Fix region highlighting
nick-skriabin Jun 18, 2025
06f4612
Fix regions highlight
nick-skriabin Jun 18, 2025
e2755a0
Biome
nick-skriabin Jun 18, 2025
fedf15e
Remove redundant check
nick-skriabin Jun 19, 2025
c63c522
Increase waiting time
nick-skriabin Jun 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/source/includes/tags/bitmask.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### Parameters

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| name | <code>string</code> | | Name of the element |
| toName | <code>string</code> | | Name of the image to label |
| [choice] | <code>single</code> \| <code>multiple</code> | <code>single</code> | Configure whether the data labeler can select one or multiple labels |
| [maxUsages] | <code>number</code> | | Maximum number of times a label can be used per task |
| [showInline] | <code>boolean</code> | <code>true</code> | Show labels in the same visual line |
| [smart] | <code>boolean</code> | | Show smart tool for interactive pre-annotations |
| [smartOnly] | <code>boolean</code> | | Only show smart tool for interactive pre-annotations |

10 changes: 10 additions & 0 deletions docs/source/includes/tags/bitmasklabels.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
### Parameters

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| name | <code>string</code> | | Name of the element |
| toName | <code>string</code> | | Name of the image to label |
| [choice] | <code>single</code> \| <code>multiple</code> | <code>single</code> | Configure whether the data labeler can select one or multiple labels |
| [maxUsages] | <code>number</code> | | Maximum number of times a label can be used per task |
| [showInline] | <code>boolean</code> | <code>true</code> | Show labels in the same visual line |

6 changes: 4 additions & 2 deletions web/libs/core/src/lib/utils/feature-flags/ff.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FF_SAMPLE_DATASETS } from "./flags";
import { FF_BITMASK, FF_SAMPLE_DATASETS } from "./flags";

const FEATURE_FLAGS = window.APP_SETTINGS?.feature_flags || {};

Expand All @@ -12,14 +12,16 @@ const FLAGS_OVERRIDE: Record<string, boolean> = {
// Add your flags overrides as following:
// [FF_FLAG_NAME]: boolean
[FF_SAMPLE_DATASETS]: true,
[FF_BITMASK]: true,
};

/**
* Checks if the Feature Flag is active or not.
*/
export const isActive = (id: string) => {
const defaultValue = window.APP_SETTINGS?.feature_flags_default_value === true;
const isSentryOSS = window?.APP_SETTINGS?.sentry_environment === "opensource";
const isSentryOSS =
window?.APP_SETTINGS?.sentry_environment === "opensource" || process.env.NODE_ENV === "development";

if (isSentryOSS && id in FLAGS_OVERRIDE) return FLAGS_OVERRIDE[id];
if (id in FEATURE_FLAGS) return FEATURE_FLAGS[id] ?? defaultValue;
Expand Down
7 changes: 7 additions & 0 deletions web/libs/core/src/lib/utils/feature-flags/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,10 @@ export const FF_MULTICHANNEL_TS = "fflag_feat_front_bros58_timeseries_multichann
* Enables enterprise email notifications
*/
export const FF_ENTERPRISE_EMAIL_NOTIFICATIONS = "fflag_feat_front_fit_183_email_notifications_short";

/**
* Bitmask is a new image segmentation tool for masking that allows pixel-perfect editing
*
* @link https://app.launchdarkly.com/projects/default/flags/fflag_front_feat_bros_87_pixel_wise_16062025_short
*/
export const FF_BITMASK = "fflag_front_feat_bros_87_pixel_wise_16062025_short";
13 changes: 12 additions & 1 deletion web/libs/editor/src/components/ImageView/Image.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { FF_LSDV_4711, isFF } from "../../utils/feature-flags";
import messages from "../../utils/messages";
import { ErrorMessage } from "../ErrorMessage/ErrorMessage";
import "./Image.scss";
import { ff } from "@humansignal/core";
import { FF_BITMASK } from "@humansignal/core/lib/utils/feature-flags";

/**
* Coordinates in relative mode belong to a data domain consisting of percentages in the range from 0 to 100
Expand Down Expand Up @@ -84,7 +86,16 @@ if (isFF(FF_LSDV_4711)) imgDefaultProps.crossOrigin = "anonymous";
const ImageRenderer = observer(
forwardRef(({ src, onLoad, imageTransform, isLoaded }, ref) => {
const imageStyles = useMemo(() => {
const style = imageTransform ?? {};
// We can't just skip rendering the image because we need its dimensions to be set
// so we just hide it with 0x0 dimensions.
//
// Real dimension will still be available via `naturalWidth` and `naturalHeight`
const style = ff.isActive(FF_BITMASK)
? {
width: 0,
height: 0,
}
: imageTransform;

return { ...style, maxWidth: "unset", visibility: isLoaded ? "visible" : "hidden" };
}, [imageTransform, isLoaded]);
Expand Down
Loading
Loading