Show3DVolume#
- class quantem.widget.Show3DVolume(**kwargs: Any)[source]#
Bases:
AnyWidget3D volume viewer with three orthogonal slice planes.
- Parameters:
data (array_like) – 3D array of shape (nz, ny, nx).
title (str, optional) – Title displayed above the viewer.
cmap (str, default "inferno") – Colormap name.
pixel_size (float, optional) – Pixel size in angstroms for scale bar.
show_stats (bool, default True) – Show per-slice statistics.
log_scale (bool, default False) – Use log scale for intensity mapping.
auto_contrast (bool, default False) – Use percentile-based contrast.
disabled_tools (list of str, optional) – Tool groups to lock while still showing controls. Supported:
"display","histogram","playback","fft","navigation","stats","export","view","volume","all"disable_* (bool, optional) – Convenience flags mirroring
disabled_tools.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.
Examples
>>> import numpy as np >>> from quantem.widget import Show3DVolume >>> volume = np.random.rand(64, 64, 64).astype(np.float32) >>> Show3DVolume(volume, title="My Volume", cmap="viridis")
Key Methods
- Show3DVolume.set_image(data, data_b=None)[source]#
Replace the volume data. Preserves all display settings.
- Parameters:
data (array_like) – New 3D volume for volume A.
data_b (array_like, optional) – New 3D volume for volume B. Must match data shape. If not provided and dual mode is active, volume B is dropped when the new data shape differs from the old B shape.
- Show3DVolume.save_image(path: str | Path, *, plane: str | None = None, slice_idx: int | None = None, format: str | None = None, dpi: int = 150) Path[source]#
Save a volume slice as PNG, PDF, or TIFF.
- Parameters:
path (str or pathlib.Path) – Output file path.
plane (str, optional) – One of ‘xy’, ‘xz’, ‘yz’. Defaults to ‘xy’.
slice_idx (int, optional) – Slice index along the chosen axis. 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:
Playback
State Persistence