Skip to content

Commit 73c66a0

Browse files
committed
Add discussion of overlay extents
1 parent 260d758 commit 73c66a0

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

docs/examples/callbacks.ipynb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"source": [
6161
"## Overlaying a mask\n",
6262
"\n",
63-
"One potential usage of this is to overlay a mask over the images which changes for each image"
63+
"One potential usage of this is to overlay a mask over the images which changes for each image. If the shape of image is changing then you will also need to adjust the `extent` of the overlay. If this is the case then uncomment the line in the `update_mask` function."
6464
]
6565
},
6666
{
@@ -95,11 +95,23 @@
9595
"\n",
9696
"\n",
9797
"def update_mask(idx, image):\n",
98-
" overlay.set_data(gen_mask(idx, image))\n",
98+
" new_mask = gen_mask(idx, image)\n",
99+
" overlay.set_data(new_mask)\n",
100+
"\n",
101+
" # if your image is changing shape uncomment the next line\n",
102+
" # overlay.set_extent((-0.5, new_mask.shape[1] - 0.5, new_mask.shape[0] - 0.5, -0.5))\n",
99103
"\n",
100104
"\n",
101105
"labeller.on_image_changed(update_mask)"
102106
]
107+
},
108+
{
109+
"cell_type": "code",
110+
"execution_count": null,
111+
"id": "9f1e35b8-5b0e-442e-ae91-910d4ff04017",
112+
"metadata": {},
113+
"outputs": [],
114+
"source": []
103115
}
104116
],
105117
"metadata": {

0 commit comments

Comments
 (0)