Show4D#
- class quantem.widget.Show4D(**kwargs: Any)[source]#
Bases:
AnyWidgetGeneral-purpose 4D data explorer.
Displays a navigation image (left) and signal at selected position (right). Click/drag on the navigation image to explore. Draw ROI masks to average signals from a region. Supports path animation for automated scanning.
- Parameters:
data (array_like) – 4D array of shape (nav_rows, nav_cols, sig_rows, sig_cols). Accepts NumPy, PyTorch, CuPy, or any np.asarray()-compatible object.
nav_image (array_like, optional) – 2D array (nav_rows, nav_cols) to use as navigation image. If not provided, defaults to mean over signal dimensions.
title (str, optional) – Title displayed in the widget header.
cmap (str, default "inferno") – Colormap for the signal panel.
log_scale (bool, default False) – Apply log scale to signal panel.
auto_contrast (bool, default True) – Auto-contrast with percentile clipping on signal panel.
show_stats (bool, default True) – Show statistics bar below canvases.
show_fft (bool, default False) – Show FFT panel for signal.
nav_pixel_size (float, optional) – Pixel size for navigation space scale bar.
sig_pixel_size (float, optional) – Pixel size for signal space scale bar.
nav_pixel_unit (str, default "px") – Unit for navigation pixel size.
sig_pixel_unit (str, default "px") – Unit for signal pixel size.
percentile_low (float, default 0.5) – Low percentile for auto-contrast clipping.
percentile_high (float, default 99.5) – High percentile for auto-contrast clipping.
disabled_tools (list of str, optional) – Tool groups to lock while still showing controls. Supported:
"display","roi","histogram","profile","navigation","playback","stats","export","view","fft","all".disable_* (bool, optional) – Convenience flags mirroring
disabled_toolsfor each tool group, plusdisable_all.hidden_tools (list of str, optional) – Tool groups to hide from the UI. Uses the same keys as
disabled_tools.hide_* (bool, optional) – Convenience flags mirroring
disable_*forhidden_tools.
Key Methods
- Show4D.set_image(data, nav_image=None)[source]#
Replace the 4D data. Preserves all display settings.
- Show4D.save_image(path: str | Path, *, view: str | None = None, position: tuple[int, int] | None = None, format: str | None = None, dpi: int = 150) Path[source]#
Save current signal or navigation image as PNG, PDF, or TIFF.
- Parameters:
path (str or pathlib.Path) – Output file path.
view (str, optional) – ‘signal’ or ‘nav’. Defaults to ‘signal’.
position (tuple[int, int], optional) – Navigation position as (row, col) for the signal view. Defaults to current position.
format (str, optional) – ‘png’, ‘pdf’, or ‘tiff’. If omitted, inferred from file extension.
dpi (int, default 150) – Output DPI metadata.
- Returns:
The written file path.
- Return type:
Line Profile
Path Animation
- Show4D.set_path(points: list[tuple[int, int]], interval_ms: int = 100, loop: bool = True, autoplay: bool = True) Self[source]#
- Show4D.raster(step: int = 1, bidirectional: bool = False, interval_ms: int = 100, loop: bool = True) Self[source]#
State Persistence