Skip to content

Commit

Permalink
Add discussion of overlay extents
Browse files Browse the repository at this point in the history
  • Loading branch information
ianhi committed Nov 12, 2021
1 parent 260d758 commit 73c66a0
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions docs/examples/callbacks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"source": [
"## Overlaying a mask\n",
"\n",
"One potential usage of this is to overlay a mask over the images which changes for each image"
"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."
]
},
{
Expand Down Expand Up @@ -95,11 +95,23 @@
"\n",
"\n",
"def update_mask(idx, image):\n",
" overlay.set_data(gen_mask(idx, image))\n",
" new_mask = gen_mask(idx, image)\n",
" overlay.set_data(new_mask)\n",
"\n",
" # if your image is changing shape uncomment the next line\n",
" # overlay.set_extent((-0.5, new_mask.shape[1] - 0.5, new_mask.shape[0] - 0.5, -0.5))\n",
"\n",
"\n",
"labeller.on_image_changed(update_mask)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9f1e35b8-5b0e-442e-ae91-910d4ff04017",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit 73c66a0

Please sign in to comment.