> ## Documentation Index
> Fetch the complete documentation index at: https://docs.biom.science/llms.txt
> Use this file to discover all available pages before exploring further.

# Viewer Controls

> Image adjustments, channel controls, navigation, and toolbar tools.

# Viewer Controls

Relay provides a rich set of viewer controls tailored to the type of file you're viewing. Each pane has fully isolated viewport state, so adjustments in one pane don't affect others.

## Image adjustments

These controls are available for all image types in two tabs:

### Basic tab

| Control               | Range              | Description                                       |
| --------------------- | ------------------ | ------------------------------------------------- |
| **Brightness**        | 0–100              | Adjust overall image brightness (50 = neutral)    |
| **Contrast**          | 0–100              | Adjust image contrast (50 = neutral)              |
| **Gamma**             | 1–500%             | Non-linear brightness correction (100% = neutral) |
| **Saturation**        | 0–200%             | Color saturation (100% = neutral)                 |
| **Hue**               | -180 to +180       | Hue rotation (0 = neutral)                        |
| **Threshold**         | 0–255              | Binary threshold cutoff                           |
| **Posterize**         | 2–256              | Reduce color levels                               |
| **Invert**            | Toggle             | Invert image colors                               |
| **Remove Background** | Toggle + threshold | Subtract background with configurable threshold   |
| **Auto Threshold**    | Button             | Automatically calculate optimal threshold         |
| **Reset**             | Button             | Restore all adjustments to defaults               |

### Color tab

| Control           | Range        | Description          |
| ----------------- | ------------ | -------------------- |
| **Red Balance**   | -100 to +100 | Adjust red channel   |
| **Green Balance** | -100 to +100 | Adjust green channel |
| **Blue Balance**  | -100 to +100 | Adjust blue channel  |

## Channel controls (scientific images)

For multi-channel images (OME-TIFF, Zarr), the scientific controls panel provides per-channel editing:

* **Visibility toggle** — eye icon to show/hide individual channels
* **Color picker** — click the color swatch to assign a LUT color to any channel
* **Intensity histogram** — interactive SVG histogram with draggable min/max handles for display range
* **Gamma handle** — optional mid-tone adjustment on the histogram
* **Auto-contrast** — automatically calculate p1/p99 percentile display range per channel from real histogram data
* **Channel split mode** — split channels across separate panes, each showing one channel

The histogram supports 8-bit (256 bins) and 12-bit (4096 bins) data, with log-scale display and pointer/keyboard navigation.

### Image metadata

A collapsible metadata section shows:

* Dimensions (width x height x channels x Z-slices x time-points)
* Bit depth, file size, format
* Pixel scale / physical size (used for scale bar)

## Navigation

### Z-stack navigation

For multi-plane images:

* **Z-slice slider** with debounced scrubbing (100ms)
* **Play/pause animation** with configurable FPS (default 2 FPS)
* **Step forward/backward** buttons
* **Open in 3D** button — splits a new pane and loads the same image in the volume viewer
* **Z-stack export** — export selected Z-range

### Time-series navigation

For time-lapse images, use the time slider to scrub through time points.

### Keyboard navigation

* **Arrow keys** — advance Z-slice or time-point
* **Shift + Arrow keys** — advance by 10 steps
* **Delete / Backspace** — delete selected annotation or clear loaded image

### Camera controls

* **Pan** — click and drag with the hand tool, or hold middle mouse button
* **Zoom** — scroll wheel, or use the zoom buttons in the toolbar
* **Fit to view** — double-click the zoom controls to fit the image to the pane
* **Camera linking** — link pan/zoom across multiple panes so they move in sync. Click the link icon in the pane header.

### Minimap

A bird's-eye overview of the full image with a viewport rectangle. Click to navigate. Toggle via right-click context menu or the minimap icon. Setting persists per-pane.

### Scale bar

Toggle the scale bar overlay for images with physical pixel size metadata. Shows in the bottom-right corner.

## Image layers (multi-image overlay)

Overlay multiple images in a single pane by holding **Alt** while dropping a file:

* Up to **8 image layers** per pane
* Per-layer controls: **opacity** (0–100%), **visibility** toggle, **blend mode**, z-order
* Reorder layers with move-up/move-down buttons
* Each layer has independent channel overrides
* Focus a layer to make it the active editing target

The Image Layer panel appears in the sidebar when a pane has 2+ layers.

## Toolbar tools

| Tool          | Shortcut | Description                                              |
| ------------- | -------- | -------------------------------------------------------- |
| **Select**    | V        | Select and move objects on the canvas                    |
| **Pan**       | H        | Pan the view by clicking and dragging                    |
| **Rectangle** | —        | Draw rectangle shapes or regions                         |
| **Circle**    | —        | Draw circle shapes or regions                            |
| **Line**      | —        | Draw line shapes                                         |
| **Text**      | T        | Add text annotations                                     |
| **Pen**       | —        | Freehand drawing on the canvas                           |
| **Comment**   | —        | Place comments at specific locations                     |
| **SAM Point** | —        | Click to segment with SAM (foreground/background points) |
| **SAM Box**   | —        | Draw a bounding box to segment with SAM                  |

### Region selection tools

| Tool                 | Shortcut | Description                                |
| -------------------- | -------- | ------------------------------------------ |
| **Rectangle Select** | Q        | Select a rectangular region for processing |
| **Circle Select**    | W        | Select a circular region                   |
| **Lasso Select**     | E        | Freehand region selection                  |
| **Polygon Select**   | Y        | Point-by-point polygon selection           |

### Context menu (right-click)

* **Add Image to Deck** — capture the current viewport as a card
* **Show Minimap** — toggle the bird's-eye overview

## Volume 3D viewer

When viewing Z-stacks, click **Open in 3D** to open the volume renderer in a new pane:

| Control           | Options                               | Description                                            |
| ----------------- | ------------------------------------- | ------------------------------------------------------ |
| **Render Mode**   | Volume / MIP / Isosurface             | Rendering algorithm                                    |
| **Color Map**     | Transfer function presets             | Color mapping for intensity values                     |
| **Opacity**       | 0–100%                                | Volume opacity                                         |
| **Brightness**    | 0.1–3x                                | Volume brightness multiplier                           |
| **Iso Threshold** | 0–255                                 | Isosurface extraction threshold (Isosurface mode only) |
| **Quality**       | Low (128) / Medium (256) / High (512) | Number of ray-marching steps                           |
| **Ortho Views**   | Toggle                                | Show XY/XZ/YZ cross-section panels                     |
| **Clip Planes**   | X/Y range sliders                     | Clip the volume in X and Y (0–100%)                    |

## DICOM-specific controls

When viewing DICOM files, adjustments map to DICOM-standard window/level:

* **Window/Level presets** — dropdown with anatomy presets (Lung, Bone, Brain, etc.)
* **Brightness = Window Center** / **Contrast = Window Width**
* **Series selector** — switch between DICOM series in multi-series studies
* **DICOM invert** — toggle MONOCHROME1/MONOCHROME2
* Supports both single files and multi-slice folders

## Video playback controls

When viewing video files:

* **Play/Pause** — start or stop playback
* **Skip** — jump forward or backward
* **Frame slider** — scrub to any frame
* **Speed selector** — adjust playback speed
* **Frame counter** — current frame number display
* Videos auto-pause when you select an annotation tool, so you can annotate individual frames

## Spike viewer controls

For electrophysiology data (NWB, H5, SpikeGLX .bin+.meta files):

* **Waveform viewer** — extracted spike waveforms
* **Power spectrum** — frequency domain analysis
* **Detail channel** — zoomed view of individual channels
* **Amplitude scatter** — spike amplitude distributions
* **Correlogram** — cross-correlogram between units
* **ISI histogram** — inter-spike interval distribution (linear or log scale)
* **Template viewer** — average waveform templates per unit
* **Sorting tabs** — view and navigate sorting results
