Skip to content

Instantly share code, notes, and snippets.

@psobolewskiPhD
Created September 23, 2021 11:12
Show Gist options
  • Save psobolewskiPhD/ead0522775271893e865bce57cdf4268 to your computer and use it in GitHub Desktop.
Save psobolewskiPhD/ead0522775271893e865bce57cdf4268 to your computer and use it in GitHub Desktop.
# %%
import napari
from skimage import data
# %%
viewer = napari.Viewer()
image = viewer.add_image(data.astronaut(), rgb=True)
image.data.shape
# %%
viewer.camera.zoom = 2.5
# %%
crop = image.data[tuple(slice(i[0], i[1]) for i in image.corner_pixels.T.astype(int))]
crop.shape
# %%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment