Note
Click here to download the full example code
nD multiscale image non-uniformΒΆ
Displays an nD multiscale image
Out:
/Users/mwebermendonca/miniconda3/envs/napari-dev/lib/python3.9/site-packages/skimage/io/_plugins/imageio_plugin.py:10: DeprecationWarning: Starting with ImageIO v3 the behavior of this function will switch to that of iio.v3.imread. To keep the current behavior (and make this warning dissapear) use `import imageio.v2 as imageio` or call `imageio.v2.imread` directly.
return np.asarray(imageio_imread(*args, **kwargs))
/Users/mwebermendonca/napari/examples/nD_multiscale_image_non_uniform.py:18: 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=3, multichannel=True)
multiscale level shapes: [(6, 1536, 1536, 3), (6, 768, 768, 3), (6, 384, 384, 3), (6, 192, 192, 3)]
/Users/mwebermendonca/miniconda3/envs/napari-dev/lib/python3.9/site-packages/vispy/gloo/glir.py:853: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
elif LooseVersion(this_version) < '2.1':
/Users/mwebermendonca/miniconda3/envs/napari-dev/lib/python3.9/site-packages/setuptools/_distutils/version.py:351: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
other = LooseVersion(other)
from skimage import data
from skimage.transform import pyramid_gaussian
import napari
import numpy as np
# create multiscale from astronaut image
astronaut = data.astronaut()
base = np.tile(astronaut, (3, 3, 1))
multiscale = list(
pyramid_gaussian(base, downscale=2, max_layer=3, multichannel=True)
)
multiscale = [
np.array([p * (abs(3 - i) + 1) / 4 for i in range(6)]) for p in multiscale
]
print('multiscale level shapes: ', [p.shape for p in multiscale])
# add image multiscale
viewer = napari.view_image(multiscale, multiscale=True)
if __name__ == '__main__':
napari.run()