.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_gallery/image_volume/image_volume_mip.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_mip.py: Volume Mip mode =============== View a volume using MIP (Maximum Intensity Projection) rendering. .. GENERATED FROM PYTHON SOURCE LINES 7-47 .. image-sg:: /_gallery/image_volume/images/sphx_glr_image_volume_mip_001.webp :alt: image volume mip :srcset: /_gallery/image_volume/images/sphx_glr_image_volume_mip_001.webp :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Imageio: 'stent.npz' was not found on your computer; downloading it now. Try 1. Download from https://github.com/imageio/imageio-binaries/raw/master/images/stent.npz (805 kB) Downloading: 8192/824612 bytes (1.0%)824612/824612 bytes (100.0%) Done File saved as /home/runner/.imageio/images/stent.npz. /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 numpy as np import fastplotlib as fpl import imageio.v3 as iio voldata = iio.imread("imageio:stent.npz").astype(np.float32) figure = fpl.Figure(cameras="3d", controller_types="orbit", size=(700, 560)) figure[0, 0].add_image_volume(voldata, mode="mip", alpha_mode="add") figure.show() # load a pre-saved camera state state = { "position": np.array([-120, 90, 330]), "rotation": np.array([-0.07280538, -0.41100206, -0.03295049, 0.90812496]), "scale": np.array([1.0, 1.0, 1.0]), "reference_up": np.array([0.0, 1.0, 0.0]), "fov": 50.0, "width": 128.0, "height": 128.0, "depth": 313, "zoom": 0.75, "maintain_aspect": True, "depth_range": None, } figure[0, 0].camera.set_state(state) # 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:** (0 minutes 1.237 seconds) .. _sphx_glr_download__gallery_image_volume_image_volume_mip.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_mip.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: image_volume_mip.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_