4d — 4D Full-Screen Browser

Interactive HDF5 dataset inspection · 4d User Manual

← Back to the 4d application (GUI)

The 4D full-screen browser — inspect a 4D-STEM dataset

The 4D full-screen browser opens whenever you open a 4D-STEM dataset in 4d's native HDF5 format (an .h5 file, e.g. from the Library or a results panel). It fills the screen with a split view: on the left the real-space side — the scan positions and the reconstructed image — and on the right the reciprocal-space side — the individual diffraction pattern recorded at the current scan position. Simply moving the mouse across the left panel selects the nearest scan position and updates the right panel live, so you can "fly" over your specimen and watch the diffraction patterns change.

Across the top runs a control bar with four groups — scan-coordinate loading and DF/BF integration, Shadow-image calculation, iDPC calculation, and Circle positioning. The small square ? help button in the top-right corner, just below the Circle positioning panel, opens this manual page.

All reconstructions (DF, BF, Shadow, iDPC) are written into the left panel, replacing the previous reconstructed image. The overlay of yellow scan-position dots can be faded in/out at any time with the Space bar.

The window, region by region

The screenshot below shows the full-screen browser with a cryo-EM 4D-STEM dataset loaded. Each region is marked with a number; the legend that follows explains what each one is and does.

The 4D full-screen browser with numbered regions 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#RegionWhat it is and does
1Load STAR file scan coordinatesPick a scan-position .star file from the project and load it, replacing the coordinates stored in the HDF5 file. Below the button, the current scan-coordinate source and the scan-generator axis convention (X right / Y down or up) are shown.
2DF / BF image calculationCalculate DF integrates each diffraction pattern over the dark-field annulus (region 14); Calculate BF integrates over the bright-field disk (region 13). Each scan position receives the integrated intensity as grey value — the resulting DF or BF image appears in the left panel (7).
3Shadow image calculationThe CF Factor and Rotation sliders control the shadow-image reconstruction; dragging them shows a live preview in the left panel. The three buttons compute the full BF, DF or FullField shadow image.
4iDPC image calculationDifferential phase contrast: DPC in X / DPC in Y compute the two shift maps, iDPC map the integrated phase image, and HP iDPC map a high-pass-filtered version (width set by the HP Width slider). The DPC-Rotation slider corrects the scan-vs-detector rotation. See below.
5Circle positioningShow/hide the circle overlays and set the DF Outer, DF Inner and BF Radius in detector pixels, plus the common Center X/Y offset (also movable with the arrow keys). Reset Center returns the center to (0, 0). The ? help button sits directly below this panel.
6Scan-position overlayEvery scan position drawn as a yellow dot over the reconstructed image. The Space bar cycles its transparency (invisible → 40% → 80%), S opens its display settings (dot size, probe diameter, animation speed…), and the mouse wheel zooms (1–20×, cursor-centred; the current zoom is shown in the title above).
7Reconstructed imageThe real-space result panel ("Reconstructed image"). It shows the most recent DF, BF, Shadow or iDPC reconstruction — or the live shadow preview while you drag the CF/Rotation sliders. Hovering here moves the current scan position.
8Zoom windowA click into the image opens the floating magnifier window centred on the clicked point; drag to move it around. The solid red dot (visible inside it here) always marks the current scan position.
9Grey-value scale (left)The grey-value range of the reconstructed image (min at the bottom, max at the top).
10Position read-outThe current scan-position index and its (x, y) scan coordinates.
11Status hintsAnimation status ("Press 'P' to start") and the reminder that a right mouse click opens the options menu.
12Diffraction patternThe 4D-STEM detector frame recorded at the current scan position ("4D-STEM dataset"). Hovering over it shows the pixel value under the cursor.
13BF disk overlayThe bright-field disk (blue) defined in the Circle positioning panel — the integration region for Calculate BF and the BF shadow image.
14DF annulus overlayThe dark-field annulus (dark yellow) between DF Inner and DF Outer — the integration region for Calculate DF, the DF shadow image, and the DPC half-circle differences. Toggle both overlays with C.
15Grey-value scale (right)The displayed intensity range of the diffraction pattern. Adjust the contrast with the Color tool (O) or quickly with B/N (brighter/darker).
16Image index & sizeThe current pattern number, the total number of patterns, and the detector frame size in pixels.
17Value read-outsThe current and global min/max of the pattern intensities, and the present DF Outer/Inner and BF radius/center values.
The numbered markers are positioned for this example screenshot; with other datasets and screen aspect ratios the proportions shift slightly, but the layout is the same. The white-framed square that appears in the left panel while dragging the CF slider is the live shadow preview window.

The Image Statistics window (key A)

Pressing A opens the Image Statistics window with the average and standard-deviation maps over all diffraction patterns of the dataset — useful for checking the detector illumination, finding the bright-field disk radius, and judging overall data quality.

The Image Statistics window with numbered regions 1 2 3 4 5 6 7
#RegionWhat it is and does
1Average / Standard Deviation tabsSwitch the map between the per-pixel average over all patterns and the per-pixel standard deviation.
2MapThe selected statistics map. With the average map, the bright disk is the direct beam — read its radius here to set BF Radius in the Circle positioning panel.
3Histogram controlsRaw patterns switches the histogram to the raw pattern values, Log scale toggles a logarithmic count axis, and Gauss fit fits a Gaussian to the peak. Scroll over the histogram to zoom.
4HistogramThe grey-value histogram of the map (or of the raw patterns), with the displayed min/max below.
5Power spectrumThe power spectrum of the map — a quick check for periodic artefacts and for the information content of the average pattern.
6Spectrum Max sliderSets the upper display limit of the power spectrum to bring out weak features.
7Map Min / Map Max slidersSet the displayed grey-value range of the map on the left.

Keyboard shortcuts

KeyAction
mouse move (left panel)Select the nearest scan position — the diffraction pattern follows the cursor live.
L  /  KStep to the next / previous pattern in the stack.
0  /  9Jump to the first / last pattern.
← ↑ → ↓With the circle overlay visible (C): move the circle center in 0.1-pixel steps. With the cursor over the scan plot: step to the nearest scan position in that direction. Otherwise: previous/next pattern.
PStart / stop the animation that plays through the patterns along the scan.
+  /  −Speed up / slow down the animation.
Shift +  /  Shift −Increase / decrease the animation step size (skip more / fewer positions per frame).
AOpen the Image Statistics window (average / standard-deviation patterns with histogram and power spectrum).
DToggle the display of average-subtracted patterns (each pattern minus the dataset average — enhances the weak scattered signal).
CShow / hide the BF and DF circle overlays (and the Circle Definition controls).
SOpen the scan-position display settings (dot size, transparency, probe diameter, animation, zoom, coordinate convention).
SpaceCycle the scan-position overlay transparency: invisible → 40% → 80% → invisible.
IDisplay coordinate info under the cursor.
OOpen the contrast / brightness (color lookup) tool.
B  /  NQuick-adjust: brighter / darker.
.  /  ,Zoom in / out.
MShow the mouse-button assignment overlay.
GSave a screen shot.
HToggle the built-in help overlay.
Ctrl+FToggle full-screen / windowed display.
EscClose the browser window.

The right mouse click (and other mouse actions)

A right mouse click anywhere in the browser opens the 4D Viewer options menu (also reachable with Ctrl + left click). It collects all the actions above in one place, with their shortcuts shown:

Menu entryShortcutWhat it does
Show Full ScreenCtrl+FToggle between full-screen and windowed display.
Display Coordinate InfoIShow the coordinate information tool.
Zoom › Zoom In / Zoom Out. / ,Change the display magnification.
Adjust Contrast/BrightnessOOpen the color-lookup tool for the displayed grey values.
Quick-Adjust Brightness › Brighter / DarkerB / NOne-step brightness changes.
Show Mouse Button AssignmentMDisplay what each mouse button does.
Screen ShotGSave an image of the current display.
Play AnimationPStart/stop playing through the diffraction patterns.
Navigation › First / Last / Previous / Next Image0 / 9 / K / LMove through the pattern stack.
SettingsSOpen the scan-position display settings.
Circle DefinitionCShow/hide the BF/DF circle overlays.
Cycle Scan Position TransparencySpaceFade the yellow scan-position dots.
Show Average and StdDev PatternsAOpen the Image Statistics window.
Show Baseline-Subtracted PatternsDToggle average-subtracted pattern display.
HelpHToggle the built-in help overlay.
CloseEscClose the browser.

Other mouse actions:

The reconstructions: DF, BF, Shadow and iDPC

All four reconstructions turn the 4D dataset (a 2D diffraction pattern for every 2D scan position) into a 2D real-space image displayed in the left panel. They differ in which part of each pattern they use and how they turn it into contrast. The BF disk and DF annulus are defined once, in the Circle positioning panel, and shared by all of them.

Circle positioning — defining the detector regions

Toggle the overlays with Show/Hide Circles (key C) and set, in detector pixels: the BF Radius (blue disk — the unscattered "bright-field" beam), and the DF Inner/DF Outer radii (dark-yellow annulus — the scattered "dark-field" signal). Center X/Y shifts both overlays together to compensate a de-centred diffraction pattern; with the overlay visible, the arrow keys nudge the center in 0.1-pixel steps. Use the average map of the Image Statistics window to measure the disk radius and center precisely.

BF and DF images — virtual detectors

Calculate BF and Calculate DF emulate the classical STEM detectors: for every scan position, the diffraction pattern is integrated over the BF disk (BF image) or over the DF annulus (DF image), and the integral becomes the grey value of that scan position in the reconstructed image. Bright-field contrast is dominated by absorption/phase effects of the transmitted beam; dark-field contrast highlights strongly scattering (e.g. heavier or thicker) regions. The calculation runs progressively — the image sharpens as more positions are evaluated.

Shadow images — magnified projection from overlapping disks

The shadow (or "shadowgraph") reconstruction exploits the fact that with a defocused or convergent probe, each bright-field disk is a small shadow image of the specimen area around the probe position. The algorithm places every pattern's selected region — mean-subtracted — at its scan position on a large canvas and sums the overlaps:

iDPC — integrated differential phase contrast

Differential phase contrast measures the deflection of the beam by the local electric field of the specimen. For every scan position, the annular region of the pattern is split into two half-circles and their mean intensities subtracted:

A practical workflow: press A and measure the BF disk on the average map → set BF Radius and center → press C to verify the overlays → Calculate BF for a first real-space overview → refine DF radii and calculate DF → then explore Shadow (adjust CF/Rotation on the live preview) and iDPC (adjust DPC-Rotation, then HP iDPC) for phase contrast.