fastplotlib.ImageWidget#

class ImageWidget(data, window_funcs=None, frame_apply=None, figure_shape=None, names=None, figure_kwargs=None, histogram_widget=True, rgb=None, cmap='plasma', graphic_kwargs=None)[source]#

A high-level widget for navigating through image stacks. It is a thin wrapper around an NDWidget, one add_nd_image per array, with sliders for the “t” (time) and “z” dimensions shared across every image stack.

Allowed dimension orders for each image stack, where the optional (c) is an RGB(A) channel of size 3 or 4:

n_dims

dims order

2

“xy(c)”

3

“txy(c)”

4

“tzxy(c)”

Parameters:
  • data (np.ndarray | list[np.ndarray]) – array-like or a list of array-like, one image stack per subplot

  • window_funcs (dict[str, tuple[Callable, int]], optional) – Rolling window functions along the “t” and/or “z” dims, {dim: (func, window_size)}, ex: {"t": (np.mean, 11)}. func must take an axis kwarg, window_size is in frames.

  • frame_apply (Callable | dict[int, Callable], optional) – Function(s) applied to each array’s slice before it is displayed. A single callable is applied to every subplot, a {array_index: callable} dict applies per-array. Applied after window_funcs.

  • figure_shape (tuple[int, int], optional) – manually provide the [n_rows, n_cols] shape for the figure, otherwise it is estimated

  • names (list[str], optional) – names for the subplots

  • figure_kwargs (dict, optional) – passed to the underlying ImguiFigure

  • histogram_widget (bool, default True) – make a histogram colorbar for each subplot to interactively set vmin, vmax

  • rgb (bool | list[bool], optional) – whether each array is RGB(A), i.e. the last dim is a channel of size 3 or 4

  • cmap (str, default "plasma") – colormap for the image graphics

  • graphic_kwargs (dict, optional) – passed to each ImageGraphic

Examples#

ImGUI with ImageWidget

ImGUI with ImageWidget

Image widget

Image widget

Image widget grid

Image widget grid

Image widget Video

Image widget Video

Image widget videos side by side

Image widget videos side by side

ImageWidget test viewport rects

ImageWidget test viewport rects

ipwidgets modify an ImageGraphic

ipwidgets modify an ImageGraphic

Explore Covariance Matrix

Explore Covariance Matrix

ImageWidget as QtWidget

ImageWidget as QtWidget

Explore fourier transform of images

Explore fourier transform of images