Abstract
Fast, direct electron detectors have significantly improved the spatio-temporal resolution of electron microscopy movies. Preserving both spatial and temporal resolution in extended observations, however, requires storing prohibitively large amounts of data. Here, we describe an efficient and flexible data reduction and compression scheme (ReCoDe) that retains both spatial and temporal resolution by preserving individual electron events. Running ReCoDe on a workstation we demonstrate on-the-fly reduction and compression of raw data streaming off a detector at 3 GB/s, for hours of uninterrupted data collection. The output was 100-fold smaller than the raw data and saved directly onto network-attached storage drives over a 10 GbE connection. We discuss calibration techniques that support electron detection and counting (e.g., estimate electron backscattering rates, false positive rates, and data compressibility), and novel data analysis methods enabled by ReCoDe (e.g., recalibration of data post acquisition, and accurate estimation of coincidence loss).
Introduction
Modern direct electron detectors (DEDs) have revolutionized microscopy, allowing researchers to capture "movies" of atoms and molecules in motion. However, these detectors produce a staggering amount of data—roughly 3 GB per second. At this rate, a standard 4 TB hard drive fills up in just 21 minutes. To manage this "data tsunami," researchers typically resort to binning frames, which destroys temporal resolution, or recording in short bursts, which misses rare dynamics. The core issue is that over 99% of a raw detector frame is simply thermal and readout noise. The actual signal—the "secondary electron puddles" created when an electron hits the sensor—is incredibly sparse.
The ReCoDe Framework
To address these challenges, we developed ReCoDe (Reduced Compressed Description), a multi-level reduction scheme that identifies and isolates electron puddles on-the-fly. It offers four levels of reduction depending on the researcher's needs:
- L1 (Least Lossy): Retains all pixel intensities within an electron puddle, allowing for "post-acquisition recalibration."
- L2: Stores summary statistics (like total energy or maximum intensity) for each puddle.
- L3: Stores only the binary shape and location of the puddle.
- L4 (Highest Compression): Reduces each puddle to a single coordinate (the centroid), representing the most likely entry point of the electron.
The system is highly parallelized. Using a standard workstation with 10 Intel Xeon cores, we demonstrated the ability to process a 3 GB/s stream, compress it, and save it directly to network-attached storage (NAS) over a 10 GbE connection without any data backup.
Validation and Performance
ReCoDe was validated using public benchmarks from the EMPIAR archive, simulated data at various electron fluxes, and experimental HRTEM movies of molybdenum disulfide (MoS2).
- Compression Performance: ReCoDe achieved 2–8× better compression than existing state-of-the-art formats like MRCZ on public datasets. On simulated counting data, it reached 100× to 250× reduction.
- Real-time Throughput: The system successfully handled a continuous 3 GB/s stream for 90 minutes, converting it into a manageable ~200 MB/s output.
- Cost Efficiency: Storing raw data from a high-end detector can cost between $20,000 and $400,000 per year. ReCoDe reduces this cost by two orders of magnitude.
Discussion and Future Outlook
A key innovation of ReCoDe is the power of L1 recalibration. In low-dose experiments, it is difficult to ensure perfect detector calibration in real-time; ReCoDe allows researchers to tweak thresholds post-acquisition to eliminate artifacts. Furthermore, preserving puddle shapes (L1-L3) is essential for accurately estimating coincidence loss, which is often biased if only centroids (L4) are stored.
Current limitations include hardware bottlenecks where closed detector software prevents in-memory access to raw data. Future work will explore using machine learning on L1 puddle shapes to automatically filter out backscattered electrons in real-time. Additionally, as detector speeds move into the MHz range, even faster meta-compressors like Blosc will become mandatory to maintain real-time performance.
Summary updated