Change origin of 3D canvas

Hi again :slight_smile:,

I have observed that when I add two datasets like:

from skimage import data
import napari

blobs = data.binary_blobs(length=64, volume_fraction=0.1, n_dim=3).astype(
    float
)

viewer = napari.Viewer(ndisplay=3)
viewer.add_image(data.astronaut(), rgb=True)
viewer.add_image(blobs, scale=[3, 1, 1])

The origin of the 3D canvas is at the center of the astronaut image, so the rotation is around that point. However, if I switch the order of loading images, the origin is located at the center of the blobs, causing a new rotation point.

Can I change the origin point after loading images?

Besides, I would like to know if is possible move the canvas en 3D mode, like in 2D mode by left click.

Thanks napari team! great soft :slight_smile:

Hi @scaracciolo. We have some improvements underway (hopefully merged < 2 weeks) to improve the API for setting the camera origin, see an old PR here https://github.com/napari/napari/pull/854 (we might end up closing this one and making a new one, but it should be pretty similar). This will make setting the origin programmatically much easier.

Right now you can move the origin interactively by shift-dragging in 3D rendering mode.

Let me know if you want more help with this now, otherwise I’m hoping for our 0.4.0 release we’ll have this API better

2 Likes

Thanks! I really appreciate your help! I’m waiting merge!

1 Like

Small note: I’m a co-creator of napari and I only discovered shift-drag last week! :sweat_smile:

2 Likes