Note
Go to the end to download the full example code
nD multiscale image¶
Displays an nD multiscale image
base shape (8, 1536, 1536)
multiscale level shapes: [(8, 1536, 1536), (4, 768, 1536), (2, 384, 1536)]
import numpy as np
from skimage.transform import pyramid_gaussian
import napari
# 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, channel_axis=-1)
)
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()