Napari Interactive 3D Image Transformations

Hi,

Is there a way to interactively manipulate the 3D affine transformation data for an image layer in Napari? For example, to have a slider that rotates an image in 3D space.

Best wishes,

Nick

2 Likes

We don’t support this yet. There was some early work on supporting this in 2D that actually predated our general affine transforms, that we’ll probably want to revisit now, see https://github.com/napari/napari/pull/989. So we could have a mode that you entered to make these sorts of adjustments, but 3D might be a bit tricker, as rotations in 3D are more complex.

Do you mind adding some more detail about what your use case? I know some others are thinking about 3D registration using affines too and it could be helpful to exchange ideas - cc @GenevieveBuckley

1 Like

Thank you for your quick reply! That’s good to know, thank you. Yes, it’s exactly the use case you mention: 3D registration of 2D images using affines. I want to be able to move each layer independently of each other, and being able to simply alter an underlying transformation matrix without touching the original image data would make that possible.

Is there anything about napari’s design that makes that a challenging feature to add in, or is this simply a matter of connecting up the transformation matrix as an event signal? Quickly reading through the PR you linked, it’s not totally clear to me how napari segregates homogenous image cooredinate space from the scene/world coordinate space.

it’s not totally clear to me how napari segregates homogenous image cooredinate space from the scene/world coordinate space.

That’s a pretty fair assessment. I don’t think we are properly separating these things currently, but are in the process of getting towards this goal. @sofroniewn has been doing a fair bit of work towards this recently, he might have some suggestions for you.

1 Like

ah yes, that PR is a little outdated, and we’ll want to revisit with the new machinery we added here https://github.com/napari/napari/pull/1616. Each layer can now take a single affine matrix as keyword arg that can do a transformation from what we call data space (think pixels of the image) into a global space. We have further ideas on how to make a more user friendly API here https://github.com/napari/napari/issues/1663