Skip to content

4D STEM

Paige Quarterman edited this page Aug 2, 2026 · 1 revision

4D-STEM

The 4D-STEM Viewer opens pixelated-detector datasets — a full diffraction pattern recorded at every scan position — and lets you build virtual-detector images from them: bright field, dark field, or any custom reciprocal-space aperture, computed after the fact from the same recorded data.

Open from Analysis ▸ 4D-STEM ▸ Nav / Pattern Viewer… (or Window ▸ Analysis Workspaces ▸ 4D-STEM Viewer) once a dataset is loaded.

Opening a dataset

Use File → Open… like any other file. Two formats are recognized:

  • Quantum Detectors Merlin .mib — a raw pixelated-detector acquisition.
  • 4D HyperSpy .hspy / .h5 / .hdf5 — a HyperSpy signal whose data is 4-dimensional (scan × detector) is content-sniffed and routed here; a ≤3D signal with the same extension opens as a normal image instead.

A 4D file never becomes a regular image — it registers in its own dataset list instead of the image library, and the viewer's dataset dropdown is how you switch between open 4D datasets. The data model is lazy: the full cube is never loaded into memory, only the navigation image, the mean pattern, and whatever block a computation currently needs.

The viewer's panels

  • Nav minimap (left) — the navigation image: detector-summed intensity at every scan position, i.e. an ordinary STEM image of the sample. Click or drag on it to move the probe.
  • Diffraction pattern (right) — the pattern at the probed position (the scan-averaged mean pattern before you probe anything), with the current aperture drawn as a ring so you can see exactly what a virtual detector would integrate.
  • Aperture controls (below) — pick a mode, set the radii, and compute.

Show nav image registers the navigation image on the main Stage like any other image, so it can be measured, calibrated, or exported independently of the 4D workflow.

Virtual detectors

Four aperture modes drive POST /api/fourd/{id}/virtual-detector:

Mode What it integrates
BF — bright field A disk centered on the direct (unscattered) beam
ABF — annular bright field A narrow annulus just inside the BF disk
ADF — annular dark field An annulus over the outer scattered intensity
Custom Freely set shape (circle/annulus), radii, and center

Apertures auto-center on the mean pattern's intensity centroid by default — turn that off to type an explicit (ky, kx) detector-pixel center. The ring drawn on the pattern panel always shows the center that will actually be used, including the auto-centered one, before you compute anything.

Compute map → it's just an image

Compute map integrates the aperture over every scan position and produces the result as an ordinary calibrated image, registered in the normal image library with the scan's pixel size carried over. That means everything else in FermiViewer — measurements, colormaps, the scale bar, export, further filtering — works on it exactly like any other opened image. Repeat with a different aperture to build up a set of maps (BF vs ADF, a sweep of annulus radii, …); each Compute map call is its own derived image, so nothing gets overwritten.

Closing a dataset

Close releases the dataset's file handle (important on Windows, where an open memmap otherwise keeps the file locked). Any nav images or virtual-detector maps you've already computed from it are ordinary images in the normal library — closing the 4D dataset does not close them; they stay open and usable until you close them individually.

Current limits

  • .mib scan shape. Merlin never records the scan dimensions in the .mib file itself — that lives in a .hdr sidecar, which real acquisitions don't always have. Without one, a .mib opens as a single-row line scan (1 × n_frames); there is no GUI control yet to supply the actual (rows, cols), so a genuine 2D scan currently displays as a 1×N strip in the nav minimap.
  • EMPAD and .blo are not supported yet — only Merlin .mib and 4D HyperSpy signals are.
  • Only single-chip and 2×2-quad Merlin chip layouts are implemented.

Next: Supported Formats.

Clone this wiki locally