.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_gallery/ndwidget/ndimage.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_ndwidget_ndimage.py: NDWidget image ============== NDWidget image example .. GENERATED FROM PYTHON SOURCE LINES 7-62 .. image-sg:: /_gallery/ndwidget/images/sphx_glr_ndimage_001.webp :alt: ndimage :srcset: /_gallery/ndwidget/images/sphx_glr_ndimage_001.webp :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/runner/work/fastplotlib/fastplotlib/fastplotlib/graphics/features/_image.py:205: UserWarning: casting float64 array to float32 warn(f"casting {data.dtype} array to float32") | .. code-block:: Python # test_example = true import numpy as np import fastplotlib as fpl data = np.random.rand(1000, 30, 64, 64) data2 = np.random.rand(1000, 30, 128, 128) # must define a reference range for each dim ref = { "time": (0, 1000, 1), "depth": (0, 30, 1), } ndw = fpl.NDWidget( ranges=ref, size=(700, 560) ) ndw2 = fpl.NDWidget( ranges=ref, indices=ndw.indices, # can create another NDWidget that shared the reference index! So multiple windows are possible size=(700, 560) ) ndi = ndw[0, 0].add_nd_image( data, ("time", "depth", "m", "n"), # specify all dim names ("m", "n"), # specify spatial dims IN ORDER, rest are auto slider dims name="4d-image", ) ndi2 = ndw2[0, 0].add_nd_image( data2, ("time", "depth", "m", "n"), # specify all dim names ("m", "n"), # specify spatial dims IN ORDER, rest are auto slider dims name="4d-image", ) # change spatial dims on the fly # ndi.spatial_dims = ("depth", "m", "n") figure = ndw.figure ndw.show() ndw2.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:** (0 minutes 7.294 seconds) .. _sphx_glr_download__gallery_ndwidget_ndimage.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: ndimage.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: ndimage.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_