.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_gallery/image_volume/image_volume_multi_channel.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr__gallery_image_volume_image_volume_multi_channel.py: Multi channel volumes ===================== Example with multi-channel volume images. Use alpha_mode "add" for additive blending. .. GENERATED FROM PYTHON SOURCE LINES 7-49 .. image-sg:: /_gallery/image_volume/images/sphx_glr_image_volume_multi_channel_001.webp :alt: image volume multi channel :srcset: /_gallery/image_volume/images/sphx_glr_image_volume_multi_channel_001.webp :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/pygfx/objects/_ruler.py:400: RuntimeWarning: divide by zero encountered in divide screen_full = (ndc_full[:, :2] / ndc_full[:, 3:4]) * half_canvas_size /opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/pygfx/objects/_ruler.py:400: RuntimeWarning: invalid value encountered in divide screen_full = (ndc_full[:, :2] / ndc_full[:, 3:4]) * half_canvas_size /opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/pygfx/objects/_ruler.py:412: RuntimeWarning: invalid value encountered in divide screen_sel = (ndc_sel[:, :2] / ndc_sel[:, 3:4]) * half_canvas_size | .. code-block:: Python # test_example = true import fastplotlib as fpl from ome_zarr.io import parse_url from ome_zarr.reader import Reader # load data url = "https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.5/idr0062A/6001240_labels.zarr" # read the image data reader = Reader(parse_url(url)) # nodes may include images, labels etc nodes = list(reader()) # first node will be the image pixel data image_node = nodes[0] dask_data = image_node.data # use the highest resolution image in the pyramid zarr voldata = dask_data[0] figure = fpl.Figure( cameras="3d", controller_types="orbit", size=(700, 700) ) # add first channel, use cyan colormap vol_ch0 = figure[0, 0].add_image_volume(voldata[0], cmap="cyan", alpha_mode="add") # add another channel, use magenta cmap vol_ch1 = figure[0, 0].add_image_volume(voldata[1], cmap="magenta", alpha_mode="add") figure.show() # NOTE: fpl.loop.run() should not be used for interactive sessions # See the "JupyterLab and IPython" section in the user guide if __name__ == "__main__": print(__doc__) fpl.loop.run() .. rst-class:: sphx-glr-timing **Total running time of the script:** (3 minutes 30.616 seconds) .. _sphx_glr_download__gallery_image_volume_image_volume_multi_channel.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: image_volume_multi_channel.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: image_volume_multi_channel.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_