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]ΒΆ
This widget facilitates high-level navigation through image stacks, which are arrays containing one or more images. It includes sliders for key dimensions such as βtβ (time) and βzβ, enabling users to smoothly navigate through one or multiple image stacks simultaneously.
Allowed dimensions orders for each image stack: Note that each has a an optional (c) channel which refers to RGB(A) a channel. So this channel should be either 3 or 4.
n_dims
dims order
2
βxy(c)β
3
βtxy(c)β
4
βtzxy(c)β
- Parameters:
data (Union[np.ndarray, List[np.ndarray]) β array-like or a list of array-like
window_funcs (dict[str, tuple[Callable, int]], i.e. {"t" or "z": (callable, int)}) β
Apply function(s) with rolling windows along βtβ and/or βzβ dimensions of the data arrays.Pass a dict in the form: {dimension: (func, window_size)}, func must take a slice of the data array asthe first argument and must take axis as a kwarg.Ex: mean along βtβ dimension: {βtβ: (np.mean, 11)}, if current_index of βtβ is 50, it will pass frames45 to 55 to np.mean with axis=0.Ex: max along z dim: {βzβ: (np.max, 3)}, passes current, previous & next frame to np.max with axis=1frame_apply (Union[callable, Dict[int, callable]]) β
Apply function(s) to data arrays before to generate final 2D image that is displayed.Ex: apply a spatial gaussian filterPass a single function or a dict of functions to apply to each array individuallyexamples:{array_index: to_grayscale}
,{0: to_grayscale, 2: threshold_img}
βarray_indexβ is the position of the corresponding array in the data list.if window_funcs is used, then this function is applied after window_funcsthis function must be a callable that returns a 2D arrayexample use case: converting an RGB frame from video to a 2D grayscale framefigure_shape (Optional[Tuple[int, int]]) β manually provide the shape for the Figure, otherwise the number of rows and columns is estimated
figure_kwargs (dict, optional) β passed to GridPlot
names (Optional[str]) β gives names to the subplots
histogram_widget (bool, default False) β make histogram LUT widget for each subplot
rgb (bool | list[bool], default None) β Includes a True or False for each
array
in the ImageWidget, indicating whether images are displayed as grayscale or RGB(A).graphic_kwargs (Any) β passed to each ImageGraphic in the ImageWidget figure subplots