Vizualization

Contents

2. Vizualization#

Functions to help visualize datasets.

mbo_utilities.graphics.run_gui(data_in: str | Path | None = None, roi: int | tuple[int, ...] | None = None, widget: bool = True, metadata_only: bool = False)#

Open a GUI to preview data of any supported type.

Works both as a CLI command and as a Python function for Jupyter/scripts. In Jupyter, returns the ImageWidget so you can interact with it. In standalone mode, runs the event loop (blocking).

Parameters:
data_instr, Path, optional

Path to data file or directory. If None, shows file selection dialog.

roiint, tuple of int, optional

ROI index(es) to display. None shows all ROIs for raw files.

widgetbool, default True

Enable PreviewDataWidget for raw ScanImage tiffs.

metadata_onlybool, default False

If True, only show metadata inspector (no image viewer).

Returns:
ImageWidget or None

In Jupyter: returns the ImageWidget (already shown via iw.show()). In standalone: returns None (runs event loop until closed).

Examples

From Python/Jupyter: >>> from mbo_utilities.graphics import run_gui >>> # Option 1: Just show the GUI >>> run_gui(“path/to/data.tif”) >>> # Option 2: Get reference to manipulate it >>> iw = run_gui(“path/to/data.tif”, roi=1, widget=False) >>> iw.cmap = “viridis” # Change colormap

From command line: $ mbo path/to/data.tif $ mbo path/to/data.tif –roi 1 –no-widget $ mbo path/to/data.tif –metadata-only