How to position layers with the layer manipulator
Summary
Sometimes objects in your data have a systematic shift relative to one another. If you need to position an entire dataset, you can use the layer manipulator. This article describes how to interactively position a layer using the layer manipulator.
Instructions
-
To run this example, first download the script from the Examples Gallery page; the link is at the bottom of the web page. Save the file to a memorable location. Or, if you've cloned this repository, the script can be found at
napari-threedee/docs/examples/plugin/layer_manipulator_plugin.py
. -
Ensure you have activated a virtual environment with napari-threedee installed. Change directories to the script location and then execute the script using:
python layer_manipulator_plugin.py
-
The viewer is initalized in 3D rendering mode. You can click and drag in the canvas to rotate the view. Note that the two layers are the same image, but not aligned.
-
Select the "image_1" layer in the layer manipulator widget. We will move layer "image_1" (the green one) to be aligned with layer "image_0".
-
Activate the layer manipulator plugin by clicking the "activate" button.
When the plugin is activated, you will see the manipulator at (0, 0, 0) on image_1 (the green image). Note that depending on your versions of
napari-threedee
andnapari
you may see subtle visual differences between your viewer and the screenshots/videos here. -
Click and drag the manipulator to align the rows. Since the layers are being rendered with additive blending, the image turns white where the layers are overlapping.