fastplotlib.NDImageSlicer#

class NDImageSlicer(data, dims, display_dims, rgb_dim=None, window_funcs=None, window_order=None, spatial_func=None, compute_histogram=True, slider_maps=None)[source]#

NDSlicer subclass for n-dimensional image data.

Produces 2-D or 3-D spatial slices for an ImageGraphic or ImageVolumeGraphic.

Parameters:
  • data (ArrayProtocol) – array-like data, must have 2 or more dimensions

  • dims (Sequence[str]) –

    names for each dimension in data. Dimensions not listed in display_dims are treated as slider dimensions and must appear as keys in the parent NDWidget’s ref_ranges

    Examples:

    ("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 grayscale ImageGraphic

    • (rows, cols, rgb_dim), a 2D RGB(A) ImageGraphic

    • (z, rows, cols), a 3D ImageVolumeGraphic

    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_dims and 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.

  • slider_maps (dict, optional) – See NDSlicer.

  • window_funcs (dict, optional) – See NDSlicer.

  • window_order (tuple, optional) – See NDSlicer.

  • spatial_func (callable, optional) – See NDSlicer.

See also

NDSlicer

Base class with full parameter documentation.

NDImage

The NDGraphic that wraps this slicer.