API Reference

Main Functions

SMLMView.smlmviewFunction
smlmview(data::AbstractArray{T,N}; kwargs...) -> NamedTuple

Launch an interactive viewer for N-dimensional array data (N ≥ 2).

Arguments

  • data: N-dimensional numeric array to display

Keyword Arguments

  • display_dims::Tuple{Int,Int}=(1,2): Which dims to display (rowdim, coldim)
  • dim_names::Union{Nothing,NTuple{N,String}}=nothing: Optional labels for each dimension
  • clip::Tuple{Real,Real}=(0.0, 1.0): Percentile clipping for intensity stretch (0.0, 1.0 = full range)
  • title::String="": Window/axis title
  • colormap::Symbol=:grays: Colormap for display
  • figsize::Tuple{Int,Int}=(800, 700): Maximum figure size in pixels
  • show::Bool=true: Whether to display the figure immediately

Returns

NamedTuple with:

  • fig: The Makie Figure
  • ax: The image Axis
  • data: Reference to original array (no copy)
  • display_dims: Observable for current display dimensions
  • slice_indices: Vector of Observables for each dim's slice index
  • colorrange: Observable for intensity range
  • cursor_pos: Observable for cursor (row, col) position
  • pixel_value: Observable for value under cursor

Keyboard Shortcuts

  • 1-9 + 1-9: Two-number sequence sets display_dims (e.g., 21 for transpose)
  • c: Cycle colormap (grays, inferno, viridis, turbo, plasma, twilight)
  • m: Cycle mapping (linear, log, p199, p595)
  • g: Cycle stretch mode (global, slice)
  • r: Reset view (fit entire image)
  • i/o: Zoom in/out
  • e/s/d/f: Pan up/left/down/right
  • j/l: Previous/next slice on first slider dim

Example

using SMLMView

# 3D data
data3d = rand(256, 256, 10)
v = smlmview(data3d)

# 4D data with custom display
data4d = rand(64, 64, 10, 5)
v = smlmview(data4d; display_dims=(1, 3), dim_names=("Y", "X", "Z", "T"))

# Change view interactively: press 2 then 3 to show dims (2,3)

Notes

  • Data is displayed with standard image orientation: row 1 at top, col 1 at left
  • Status bar shows current display dims: (1,2) means dim1→rows, dim2→cols
  • For N-dim data, N-2 sliders are created for non-display dimensions
source
smlmview(channels::Tuple{Vararg{AbstractArray}}; kwargs...) -> NamedTuple

Launch an interactive viewer for multi-channel composite display.

Arguments

  • channels: Tuple of 2-3 arrays with matching spatial dimensions

Keyword Arguments

  • colors: Channel colors, default CMY (cyan, magenta, yellow)
  • names: Channel names for display
  • display_dims::Tuple{Int,Int}=(1,2): Which dims are (rows, cols)
  • clip::Tuple{Real,Real}=(0.0, 1.0): Percentile clipping (0.0, 1.0 = full range)
  • figsize::Tuple{Int,Int}=(800, 700): Max figure size
  • show::Bool=true: Whether to display immediately

Keyboard Shortcuts

  • 1/2/3: Toggle channel visibility
  • m: Cycle mapping (linear, log, percentile)
  • g: Cycle stretch mode (global, slice)
  • j/l: Previous/next slice
  • i/o: Zoom in/out
  • r: Reset view

Example

ch1 = rand(256, 256, 10)  # "DAPI"
ch2 = rand(256, 256, 10)  # "GFP"
ch3 = rand(256, 256, 10)  # "Alexa647"
v = smlmview((ch1, ch2, ch3); names=("DAPI", "GFP", "A647"))
source
SMLMView.configure_display!Function
configure_display!(; port=8080)

Configure WGLMakie and Bonito server for display. Call once per Julia session. Automatically called on first smlmview() if not already configured.

For VSCode Remote, this sets up the proxy_url for proper WebSocket tunneling.

source

Keybinding Functions

SMLMView.set_keybinding!Function
set_keybinding!(action::String, key::String)
set_keybinding!(action::Symbol, key::String)

Set a keybinding for an action. Persists to LocalPreferences.toml.

Example

SMLMView.set_keybinding!(:zoom_in, "k")
SMLMView.set_keybinding!("pan_up", "w")
source

Constants

SMLMView.DEFAULT_CHANNEL_COLORSConstant
DEFAULT_CHANNEL_COLORS

Default channel colors for multi-channel composite viewing (Cyan, Magenta, Yellow). CMY additive blending: C+M=Blue, C+Y=Green, M+Y=Red, C+M+Y=White.

source
SMLMView.CHANNEL_COLOR_PRESETSConstant
CHANNEL_COLOR_PRESETS

Named color presets for multi-channel composite viewing. Available presets: :cmy (default), :rgb, :mgc (Magenta-Green-Cyan).

source