nD multiscale imageΒΆ

Displays an nD multiscale image

Tags: visualization-advanced

nD multiscale image
base shape (8, 1536, 1536)
/home/runner/work/napari/napari/examples/nD_multiscale_image.py:20: FutureWarning: `multichannel` is a deprecated argument name for `pyramid_gaussian`. It will be removed in version 1.0. Please use `channel_axis` instead.
  pyramid_gaussian(base, downscale=2, max_layer=2, multichannel=False)
multiscale level shapes:  [(8, 1536, 1536), (4, 768, 768), (2, 384, 384)]

from skimage.transform import pyramid_gaussian
import napari
import numpy as np


# create multiscale from random data
base = np.random.random((1536, 1536))
base = np.array([base * (8 - i) / 8 for i in range(8)])
print('base shape', base.shape)
multiscale = list(
    pyramid_gaussian(base, downscale=2, max_layer=2, multichannel=False)
)
print('multiscale level shapes: ', [p.shape for p in multiscale])

# add image multiscale
viewer = napari.view_image(multiscale, contrast_limits=[0, 1], multiscale=True)

if __name__ == '__main__':
    napari.run()

Gallery generated by Sphinx-Gallery