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, Shadow-image calculation (which also holds the BF and DF virtual detectors), iDPC and iCOM 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 18 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.
2Scan-coordinate sourceThe file or HDF5 dataset the current scan coordinates come from, and the scan-generator axis convention — X points right, Y points down or up. The button toggles the Y direction; every reconstruction flips with it.
3Shadow image calculationAll real-space reconstructions except iDPC/iCOM. The CF Factor and Rotation sliders control the shadow-image reconstruction and show a live preview while dragged. BF_Shadow / DF_Shadow compute the two shadow images, BF / DF the virtual-detector images, and the bottom row the two difference images BF_Shadow − DF and Shadow − Mean, whose subtracted image is weighted by the Subtr. Contrast slider.
4iDPC and iCOM image calculationDifferential phase contrast: DPC in X / DPC in Y compute the two half-circle shift maps and COM in X / COM in Y the centre-of-mass equivalents; iDPC map and iCOM integrate them into a phase image, and High-pass map adds a Gaussian high-pass (width set by the HP Width slider). The 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 & histogram (left)The displayed grey-value range of the reconstructed image (min at the bottom, max at the top), with the image’s histogram drawn to the left of the bar, perpendicular to the grey axis. Drag along the bar to display only that grey range; double-click it to return to the full range.
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 detector value under the cursor, taken from the data themselves (while the dataset is held in memory), so neither the Color tool's inversion nor the displayed contrast range affects it.
13BF disk overlayThe bright-field disk (blue) defined in the Circle positioning panel — the integration region for BF and BF_Shadow.
14DF annulus overlayThe dark-field annulus (dark yellow) between DF Inner and DF Outer — the integration region for DF and DF_Shadow, the DF image subtracted in BF_Shadow − DF, and the DPC deflection maps. COM does not use the annulus: it takes the intensity-weighted centre of the whole disk out to DF Outer, bright-field disk included, so DF Inner plays no part in it. Toggle both overlays with C.
15Grey-value scale & histogram (right)The displayed intensity range of the diffraction pattern, with its histogram to the right of the bar. Drag along it to restrict the display to a grey range, double-click to reset to the full range. The Color tool (O) and B/N (brighter/darker) do the same numerically.
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.
18Value under the cursorVal: shows the grey value of the reconstructed image under the mouse pointer, in the same units as the scale bar (9). It follows the cursor live and disappears when the pointer leaves the image.
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

The BF and DF buttons — in the second row of the Shadow image calculation panel — 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, and the grey-value scale bar next to the image (9) follows it, always showing the range currently displayed.

Both maps hold one value per scan position. What is drawn is a resampled copy of them: the map is generated with between 256 and 4096 pixels per axis, so a small scan is upscaled to blocks of identical pixels and a scan larger than 4096 positions along an axis is downsampled. The scan-position dots mark the centres of the blocks. The maps are displayed over a range of mean ± 2 σ of the integrated intensities, stretched by the Contrast and Brightness settings of the scan-position dialog (S).

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:

The BF_Shadow − DF image is smaller than the plain BF_Shadow image by one diffraction pattern in each direction, because the tapered border where no DF values exist is cropped away. Its console output reports the output size, the DF grid, and the scan step in output pixels, so the registration of the two images can be checked numerically.

iDPC and iCOM — 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:

The grey-value bars — histogram and display range

Each of the two images carries a vertical grey-value bar: white at the top for the maximum, black at the bottom for the minimum, with the two values written above and below it. The histogram of the displayed image is drawn alongside the bar, perpendicular to the grey axis and pointing away from its image — to the left of the bar for the reconstructed image, to the right of the bar for the diffraction pattern. Counts are square-root scaled so that a single dominant peak does not flatten the rest of the distribution.

On the diffraction-pattern side this is the same display range that the Color tool (O) sets numerically, so the two stay in step; a reset there returns to the full recorded range of the dataset. On the reconstruction side the window is dropped automatically as soon as a new image is calculated, since the new image brings its own grey range.

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 → BF for a first real-space overview → refine the DF radii and press DF → then explore the shadow images (adjust CF/Rotation on the live preview, then BF_Shadow) and iDPC (adjust the Rotation, then iDPC map and High-pass map) for phase contrast. Drag on a grey-value bar whenever a result looks flat — most reconstructions have a few outlying pixels that compress the interesting range.