fastplotlib.VideoSlicer#
- class VideoSlicer(data, dims, display_dims, rgb_dim=None, window_funcs=None, window_order=None, spatial_func=None, compute_histogram=True, slider_maps=None)[source]#
NDImageSlicersubclass for video data, used byNDWSubplot.add_video().Reads the frame at the current index directly. Window functions are not currently implemented for video.
A YUV frame is a tuple of (Y, U, V) planes rather than a single array, so it is passed through as a tuple for an
ImageYUVGraphic.NDSlicersubclass for n-dimensional image data.Produces 2-D or 3-D spatial slices for an
ImageGraphicorImageVolumeGraphic.- Parameters:
data (ArrayProtocol) – array-like data, must have 2 or more dimensions
dims (Sequence[str]) –
names for each dimension in
data. Dimensions not listed indisplay_dimsare treated as slider dimensions and must appear as keys in the parentNDWidget’sref_rangesExamples:
("time", "depth", "row", "col") ("row", "col") ("other_dim", "depth", "time", "row", "col")
dims in the array do not need to be in the order that you want to display them, for example you can have a weird array where the dims are interpreted as:
("col", "depth", "row", "time"), and then specify display_dims as("row", "col").display_dims (tuple[str, str] | tuple[str, str, str]) –
The 2 or 3 spatial dims in display order, which also determines the graphic used for rendering:
(rows, cols), a 2D grayscaleImageGraphic(rows, cols, rgb_dim), a 2D RGB(A)ImageGraphic(z, rows, cols), a 3DImageVolumeGraphic
The ordering determines how the image or volume is rendered. For example, if you specify
display_dims = ("rows", "cols")and then change it to("cols", "rows"), it will display the transpose.rgb_dim (str, optional) – Name of the RGB(A) dim, if present. It must be listed in
display_dimsand be of size 3 or 4.compute_histogram (bool, default True) – Compute a histogram of the data, disable if random-access of data is not blazing-fast (ex: data that uses video codecs), or if histograms are not useful for this data.
spatial_func (callable, optional) – See
NDSlicer.