Abstract
The exposure of frozen biological samples to the high-energy electron beam in a cryo-electron microscope commonly leads to beam-induced sample motion and distortions. Previously, we described Unblur, which is part of our cisTEM software to correct for beam-induced motion based on the alignment of full frames in a movie collected during the beam exposure (Grant et al., 2015). However, Unblur cannot accommodate motion due to more localized sample bending and distortions. Here, we present Unbend, extending Unblur by incorporating local motion correction using a three-dimensional cubic spline model. The 3D spline model is constructed using cubic B-splines along the exposure time axis, and bicubic B-splines within movie frames. Unbend is integrated into our cisTEM software with a new local motion visualization panel within the cisTEM graphical user interface. We processed movie frames from various in-situ sample types, including whole cells, lamellae, and cell lysates, to analyze motion behavior across different specimen types. To quantify the improvement in high-resolution signal, we utilized the 2D template matching method, which operates independently of the motion correction process, to search large ribosomal subunits from the motion-corrected micrographs. Overall, the signal-to-noise ratio of detected particles improved by 3 ∼ 8% across different samples compared with full-frame aligned micrographs, while the number of detected target particles increased by up to ∼ 300%. The total and Von Mises equivalent strain shows a deformation scale of less than 1% in most of the samples, confirming that our model induces minimal additional distortion. Furthermore, we processed micrograph montages to study motion patterns across an entire sample, revealing considerable variance in distortion scale within the same sample, suggesting a complex underlying mechanism.
Introduction
Cryo-electron microscopy (cryo-EM) enables structural biologists to observe diverse biomolecules in their native environment. The molecules are preserved in amorphous ice, and in the most favorable cases, their 3D structure can be reconstructed at near-atomic resolution. An important factor determining the attainable resolution are high-quality micrographs, containing high-resolution signal of the molecules. This high-resolution signal is attenuated by radiation damage and sample motion during the exposure (beam-induced motion, BIM). To minimize this attenuation, images are commonly recorded as a series of movie frames, each containing a fraction of the total electron exposure (Brilot et al., 2012; Campbell et al., 2013, Li et al., 2013). The frames are then filtered according to the radiation damage suffered by the sample, and averaged into a single micrograph. We have previously developed the program Unblur, which is part of cisTEM (Grant et al., 2018), to perform alignment of full movie frames and exposure filtering (Grant & Grigorieff, 2015). However, as discussed in the following, full-frame alignment cannot correct for local distortions and bending of the sample under the electron beam.
While full-frame alignment is often sufficient to achieve 3D reconstructions at near-atomic resolution, more complicated patterns of sample deformation have been observed that cannot be corrected in this manner. A simple model describes the deformation as a drum-like motion (Brilot et al., 2012; Zheng et al., 2017; Naydenova et al., 2020), which leads to differential sample motion across the field of view. The primary driver of this motion and deformation is thought to be strain that develops in the sample during rapid freezing (Naydenova et al., 2020; D’Imprima & Kühlbrandt, 2021).
Different algorithms have been developed to correct micrographs and tomograms for more complicated motion patterns (Li et al., 2013; Scheres, 2014; Abrishami et al., 2015; Grant & Grigorieff, 2015; Rubinstein & Brubaker, 2015; Zheng et al., 2017; Zivanov et al., 2019; Tegunov & Cramer, 2019; Střelák et al., 2020). The widely used software MotionCor2 employs polynomial equations to fit drum-like motion (Zheng et al., 2017). Warp (Tegunov & Cramer, 2019) and CryoSPARC (Punjani et al., 2017) use a spline-based model, which provides more flexibility in representing different types of distortion. More complicated distortion models may increase the resolution of 3D reconstructions of particles extracted from the corrected micrographs or tomograms. However, 3D reconstruction requires multiple image processing steps, and often involves additional manual decisions, making it difficult to directly measure the impact of local distortion correction. Thus, it has not been quantified how great the improvements by local distortion correction are, nor how different types of samples, often exhibiting different degrees of distortion, benefit from it. To fill this gap, we set out to develop a tool to model and visualize local motion, and to quantify the improvements in the micrographs upon distortion correction.
In this paper, we introduce new movie alignment software, Unbend, along with a comprehensive description of a new distortion correction model based on 3D cubic splines that is designed to apply pixel-wise correction of local motion. Unbend features two alignment steps: a full-frame alignment similar to Unblur (Grant & Grigorieff, 2015), which is part of cisTEM (Grant et al., 2018), and patch-based alignment to generate reference points to initialize the 3D spline model. The spline model is then refined by optimizing a summed patch-wise cross-correlation loss function. The shift amount for each pixel is computed using the refined model and applied to the micrograph to generate a corrected micrograph with improved high-resolution signal. We also wrote shift_field_generation, a program that reads the refined spline parameters generated by Unbend to plot pixel-wise shift fields for each movie frame.
We demonstrate the model’s effectiveness using a variety of cellular sample types, including whole cells (both bacterial and mammalian), lamellae (yeast and mammalian cells), and cell lysates, highlighting how local motion varies across specimens. By tracking the displacement of each patch from the first to the last frame, we measured the amount of motion in these different samples. Using the pixel-wise shift fields of the last frame with respect to the first frame, we quantified the amount of deformation and calculate the total equivalent strain (overall magnitude of volumetric and deviatoric deformation, Malvern, 1969; Belytschko et al., 2000) and the Von Mises equivalent strain (magnitude of deviatoric deformation, Hill, 1950). By integrating these metrics with 2D template matching (2DTM) (Rickgauer et al., 2017), we directly quantified the effects of local motion in the micrograph and assessed the improvement in the 2DTM signal-to-noise ratio (SNR) following distortion correction. Our results show that Unbend improves the 2DTM SNR by 3 ∼ 8% and increases the number of detected targets by up to 300% in a dataset, depending on the type of sample being imaged.
Distortion Modeling, Correction, and Verification
Full-frame alignment
During the acquisition of cryo-EM data, various types of sample motion can occur, including beam-induced motion and mechanical movement of the sample due to stage instabilities. Correcting for this motion is an important step in obtaining high-resolution 3D reconstructions of the imaged molecules. In this work, we address more complicated patterns of sample motion by separately performing full-frame alignment and local distortion correction due to sample deformation.
For full-frame alignment, we closely follow our previous version of Unblur (Grant & Grigorieff, 2015) using alignment in three iterations with increasing resolution. The shift for each frame is initially determined using the cross-correlation map between the current frame and the sum of all other frames. Given the low electron exposure per frame, single-frame alignment can be susceptible to noise and misalignment. A large B-factor, which can be adjusted by the user, is applied during this step to suppress high-resolution noise. Sample drift due to mechanical instabilities of the cryo stage is expected to be slowly varying in speed and mostly along a fixed direction. This allows the full-frame shifts to be smoothed using a Savitzky-Golay (SG) filter, which effectively models sample drift while preserving molecular features in the image, and without introducing potential image distortions. The full-frame alignment and trajectory smoothing are sufficient in many cases to achieve 3D reconstruction at near-atomic resolution (Grant & Grigorieff, 2015; Oldham et al., 2016; Subramaniam et al., 2018).
In some cases, the shifts determined for individual frames deviates significantly from the smoothed trajectory. This could be due to noise but may also reflect properties of the sample or stage, and hence these outliers could represent real physical motion of the sample. Therefore, solely relying on the smoothed curves means that the shifts derived from cross-correlation are not directly applied in the correction, even if they represent real physical motion. To allow potential discontinuities in the motion trajectories in our new approach, we have removed this smoothing function in Unbend. Instead of using the SG-filtered shifts, we compare the raw shifts to the smoothed curve and identify those shifts that deviate my more than 1.5 times the interquartile range (IQR) from the curve. These outlier shifts are further aligned using a B-factor twice that of the initial alignment (the default B-factor for the initial alignment is 1500 Å2). If shifts remain significantly different after this adjustment, we accept them as the true shifts; otherwise, we apply the new shift values. This strategy helps us detect and correct potential misalignments caused by weak signal in individual frames while preserving the information contained in the raw shifts about real sample motion that does not fit a smooth trajectory.
Patch alignment
To correct for local sample distortion, patch-based methods are widely utilized. By aligning small patches across the entire micrograph, these methods can accurately capture local motion. Increasing the number of patches and reducing the patch size can provide more accurate local information but also limits the amount of signal per patch, leading to noisier alignments. To balance these factors, we set a patch size of 1024 × 1024 pixels when the output pixel size is < 0.5 Å, and 512 × 512 pixels when the output pixel size is between 0.5 and 2.0 Å. For output pixel sizes > 2.0 Å, the 512 × 512 pixel patch size is scaled by a factor equal to the output pixel size and rounded up to the nearest multiple of 16 to maintain computational efficiency.
The default number of patches along the x and y dimensions, denoted as NPx and NPy, are determined by rounding up the values of image dimensions divided by patch size. This configuration minimizes overlap between neighboring patches, enabling more accurate capture of local motion. Users may specify fewer patches along each dimension, resulting in larger patches that capture more signal to ensure a complete coverage of the micrograph without gaps. Conversely, increasing the number of patches does not reduce their size; instead, it increases the percentage of overlap between adjacent patches, preserving the default patch size to ensure that each patch retains sufficient signal for robust alignment.
Assuming that full-frame alignment has effectively removed the average motion in each frame, the residual motion detected by patch alignment is primarily attributed to beam-induced sample distortion. We therefore approximate the shifts determined for a given patch across movie frames (a patch stack) as a smooth trajectory. For each patch stack, the alignment is firstly estimated by calculating the cross-correlation between an individual frame and the average of all other frames, after which the shift trajectory is smoothed using a SG filter.
To identify patches with unreasonable shift sets {(xpi,fi, ypi,fi) fi ∈ {1,2, · ·, NF}}, where NF is the total number of frames, pi denotes the patch stack, and xpi,fi and ypi,fi represent the shift amounts along the x and y axes for frame fi in patch stack pi, we calculate the standard deviation of the shift differences between neighboring frames:

where

Outliers in the set σfi(pi) pi ∈ {1,2, …, NP}, with NP = NPx × NPy as the total number of patches, are detected using the 1.5 × IQR upper bound criterion. Outlier shifts are then replaced with the shift sets from their nearest-neighbor patches. This procedure effectively detects potential misalignments caused by low signal in individual patches and provides a robust initialization for the subsequent modeling of sample distortion.
Sample distortion modeling and correction
Patch-wise shifts, {(xpi,fi, ypi,fi) | pi ∈ {1,2, …, NP}, fi ∈ {1,2, · ·, NF}}, represent motion at the patch centers. To generate a distortion-corrected micrograph, these center shifts must be interpolated to obtain the shifts of every pixel in each movie frame. This requires an interpolation model, for which we employ spline functions to describe the pixel-wise shift distribution across the frames.
Spline model construction
In this study, the spline model is constructed using uniform bicubic B-splines to describe shifts in the image plane (x and y axes), and uniform cubic B-splines to constrain shifts across frames (z axis/electron exposure accumulating direction). B-spline curves and surfaces comprise sequences of low-degree polynomial segments, which help avoid high-degree global polynomials and preserve numerical stability. For both cubic and bicubic B-splines, the model guarantees C2 continuity, i.e., it is twice continuously differentiable. This property allows for smooth transitions between polynomial segments while preserving local control, since changes in a control point only affect its neighboring region. As a result, the model provides sufficient flexibility to capture a wide range of motion trajectories.
Each segment of the spline curve Sc(t) is a linear combination of basic B-spline functions Bi,d(t), weighted by neighboring control points Qi (Farin, 2001):

For degree d, the blending functions 


where t ∈ [0,1] is a normalized parameter along the spline curve. For cubic B-splines, d = 3. A cubic B-spline segment can also be written in matrix formulation for better computational efficiency:

Likewise, a bicubic B-spline surface Ss(ui, vj) follows an analogous matrix formulation:

where M is the same 4 × 4 blending-function matrix, and Qgrid is the 4 × 4 arrangement of control points Qi+k,j+l. The indices i, j specify the segment positions along the y and x axes, while u, v ∈ [0,1] are the normalized parameters along those axes.
Control points and knots
Each cubic B-spline curve segment is defined by four control points, with each control point influencing up to four adjacent segments, whereas each bicubic B-spline surface requires sixteen control points. As shown in Figure 1a, control points are not located directly on the curve. The endpoints of curve segments and the four corners of the surface segments are referred to as “knots”. Adjusting the control points alters the curve’s shape, while the knots of a uniform spline are evenly distributed. To determine a B-spline curve/surface, we only need to know the knot parameters. The relationship between control points and knots for a curve or surface segment can be expressed as (Agrapart & Batailly, 2020):

where Φ is the passing matrix determined by the Cox-de Boor algorithm and the chosen boundary conditions. In this work, we adopt free-end boundary conditions, allowing the spline to extend linearly beyond the boundary points (Figure 1b). This prevents artificial curvature at the edges, maintaining the natural flow of the surface without imposing strict derivative constraints. For a cubic spline, the free-end boundary condition is implemented as follows:

and for bicubic splines, the same condition applies along the edges. At the corners, the boundary condition is:


Uniform cubic spline curve.
(a) Diagram showing the core components of a cubic B-spline curve, such as knots, control points, and the uniform knot positions ti. (b) Diagram showing the free-end boundary condition for a cubic B-spline.
where m and n are the number of knots along x and y axes, respectively.
Knot grid configuration
Our model assigns NKx, NKy, and NKz as the number of knots along the x, y, and z axes, respectively. By default, NKx and NKy are set to two-thirds of the patch number in each dimension, with a minimum of four knots, and evenly distributed along x and y. Along the z axis, knots are spaced at every 4e−/Å of exposure, forming a three-dimensional grid together with the knots along x and y. Since shifts occur in both x and y, we maintain two sets of knot parameters, Kx and Ky. Given these knots, we can interpolate a dense field of shifts for every pixel in each movie frame, thereby correcting local distortion in each frame.
Figure 2. illustrates the knot grid and the construction of the 3D spline model. In Figure 2a, the spline curve for shifts along the x direction is shown along the exposure accumulation direction. In this case, for a movie with 40 frames and a total exposure of 16e−/Å, a knot is assigned every 10 frames. Once the shift amounts at the knots are determined, the cubic spline model, as described above, is used to compute the shift along x for each movie frame. By combining these shifts with the shifts along the y-direction, we can obtain the full spline curve thread as shown in Figure 2b. For a model with NKx, NKy knots along x and y, we will generateNKx × NKy of such 3D splines. Thus, for each movie frame, we will have a 2D grid of knots for generating the bicubic spline surface, represented by the black points in Figure 2e. Figure 2c,d show the shift fields along x and y, respectively, for a single movie frame derived using the bicubic splines. Figure 2e displays the image before (gray grid) and after (cyan grid) warping, based on the shift fields shown in Figure 2c,d. For better visualization, we amplified the distortion in these figures.
Parameter refinement
The initial refinement of knot values relies on a least-squares error minimization approach. Given the parameters Kx and Ky for the x- and y-axis, respectively, the spline model can initialize the per-patch shifts for each frame (xspline(pi, fi; Kx), yspline(pi, fi; Ky)). We estimate Kx and Ky by minimizing the following least-square loss function:


3D spline model knot grid construction and shift field generation.
(a) Diagram showing the position of knots along the exposure accumulation direction and the shift amount along x for each movie frame. (b) A 3D diagram showing the cubic B-spline along the exposure accumulation direction, with red arrows representing the shifts where the knots are located (black dots on the gray line), and the cyan curve showing the spline curve for interpolating the shifts for each frame. (c, d) Shift field along x and y showing the shift amount of each pixel obtained from the bicubic B-splines on a 10 × 10 pixels frame (for demonstration only). (e) Schematic image grid before (gray grids) and after (cyan grid) applying the shift fields in (c, d). The red arrows represent the shift of patches. Black dots represent knot positions.
Minimizing L1 aligns the spline model with the observed per-patch shifts, and yields the patch stack alignment result {(xpi,fi, ypi,fi) | pi ∈ {1,2, …, NP}, fi ∈ {1,2, · ·, NF}}. Because this initial fit relies solely on local per-patch information, a second round of refinement is done to incorporate global information. To this end, we define the following loss function:

where CC denotes the cross-correlation function between a single frame in a patch stack 

Since patches with stronger signal yield larger cross-correlation values, they contribute more heavily to L2, thereby reducing the impact of noisier patches. The optimization algorithm L-BFGS is used to update parameters Kx and Ky, producing a refined spline model that better captures the observed local movement. With these optimized parameters, pixel-wise shifts are computed, and bilinear interpolation is applied to calculate the densities at each output pixel, thereby generating the final motion-corrected movie frames. Averaging these frames produces the final corrected micrograph. As shown in Figure 2e, after applying the model-based shifts, areas near the edges may extend beyond or fall short of the original micrograph’s pixel grid. In such cases, we pad the under-extended area with the average density of the edge and trim the over-extended area to fit within the boundaries of the micrograph.
2DTM provides a one-step verification for motion correction
2D template matching (2DTM) has originally been developed to identify biomolecules in images of crowded cellular environments with high precision in both location and orientation.
The true-positive detection is based on the 2DTM SNR at each target site (Rickgauer et al., 2017; Sigworth, 2004). Because the 2DTM SNR is computed by correlating template projections with the micrograph, it provides an unbiased measure of how effective the molecular signal is preserved in the distortion-corrected micrograph. In the present study, we will use both the number of detectable particles and their 2DTM SNR as metrics for evaluating the performance of our distortion correction method.
We applied our model to a range of in-situ samples commonly studied in structural biology, including whole cells (bacteria and the edges of mammalian cells), lamellae (yeast and mammalian cells), and cellular lysate. Ribosomes, which can be detected with high accuracy by 2DTM using cisTEM (Grant et al., 2018), were chosen as the primary targets in the following experiments. Furthermore, we also tested the performance of our new algorithm on DeCo-LACE micrograph montages (Elferich et al., 2022).
Results
High resolution information recovery
Using the new graphical user interface (GUI) for motion correction in cisTEM, users can readily visualize local motion by enabling the trajectory option. Figure 3 illustrates an example micrograph acquired from Mycoplasma pneumoniae whole-cell samples. In this case, a vortex-shaped motion is observed in the region where two cells are closely adjacent to each other. The patch trajectories (shown in red) are magnified by a factor of 30 for clarity. Figure 3b, c provide zoomed-in views of the boxed area and the corresponding power spectra generated from the micrograph after local distortion-corrected alignment versus full-frame alignment, respectively. Figure 3d, e show the detected particles (white projections) using 2DTM in the micrograph processed with and without local distortion correction, respectively. The larger number of detected 2DTM targets demonstrates that the blurring caused by the local distortion has been significantly reduced by our Unbend program. This can also be seen in the power spectra calculated from the micrograph, exhibiting more pronounced Thon rings at higher resolution after local distortion correction (Figure 3b, c).

A micrograph of whole-cell Mycoplasma pneumoniae.
(a) Motion trajectory panel in the cisTEM GUI. (b) The cropped area shown in (a) without local distortion correction, experiencing blurring due to the local distortion (upper) and the power spectrum (lower). (c) The cropped area (upper) and the power spectrum of the local distortion-corrected micrograph (lower). (d) Detected particles (white) using 2DTM on the full-frame aligned micrograph. (e) Detected particles (white) using 2DTM on the local-distortion corrected micrograph.
Local motion across different samples
We benchmarked our motion-correction model using three types of in-situ specimens: whole cells, lamellae, and cell lysates. For whole cells, we used a frozen-hydrated Mycoplasma pneumoniae dataset (O’Reilly et al., 2020) previously employed for the development of 2DTM with cisTEM (Lucas et al., 2021). To enable comparison across different sample types and geometries, mammalian cells were also included, specifically, immortalized Cercopithecus aethiops (African green monkey) BS-C-1 kidney epithelial cells (see Materials and Methods). Lamella datasets originated from two eukaryotic organisms: Saccharomyces cerevisiae and immortalized Mus musculus ER-HoxB8 cells, both previously analyzed by 2DTM (Lucas et al., 2022; Elferich et al., 2022). The cell lysate sample was derived from BS-C-1 cells, as described in Materials and Methods.
To quantify the local movement, we measure the displacement of each patch’s last frame relative to its first frame in a micrograph {shpi| pi ∈ {1,2, …, NP}}, where

Since the full-frame alignment is assumed to remove the global average motion, the patch motions/shifts (shpi) primarily represent the BIM that reflect the sample’s deformation, measuring how much the patch centers are displaced from their initial positions. To characterize the extent of local motion, we compute the maximum, mean, and standard deviation of these shifts for each micrograph. We find that cell lysate exhibits the least local motion, whereas the Mycoplasma pneumoniae samples demonstrate substantially larger local motions, with maximum displacements of over 55 Å. Mus musculus cell lamella and BS-C-1 cell edge samples also show considerable local motion (up to 20 Å). As indicated by the standard deviation data in Figure 4, samples with large average patch motion also exhibit greater variability in local motion across a micrograph. Such pronounced local motion will significantly attenuate high-resolution information in the micrograph, making its correction essential for high-resolution cryo-EM experiments.

Patch shift in different types of samples.
(a) Box plots of the standard deviation of patch motions calculated for micrographs of different types of samples. (b) The mean patch shifts for each micrograph, colored by sample type.
To assess whether local motion correlates with specimen thickness, we estimated the sample thickness using CTFFIND5 (Elferich et al., 2024) and plotted the mean shift against sample thickness for each micrograph (Figure 4b). For consistency, all micrographs were binned to 1.5 Å/pixel during alignment and outliers shown in Figure 4a are excluded for better pattern visualization. BS-C-1 cell edge samples span a broad thickness range (50 ∼ 400 nm) and their mean displacements likewise cover the full range of observed shifts. Mycoplasma pneumoniae are generally thicker (150 ∼ 400 nm) and their mean displacements also distribute in the upper range (2.5 ∼ 6 Å). In contrast, cell-lysate specimens are thinner (50 ∼ 150 nm) and exhibit the least local motion, and even at the upper end (100 ∼ 150 nm) of this range exhibit mean shifts below 1 Å. However, lamellae of similar thickness show mean displacements from < 1 Å to > 6 Å. These results indicate no direct dependence of local motion on sample thickness; rather, motion magnitude is highly related to the sample type and preparation method.
Pixel-wise deformation quantification using equivalent strain
To quantify pixel-wise shifts within each movie frame, we developed shift_field_generation, a program that reconstructs the per-pixel displacement field of any given frame by interpolating the spline parameters exported by Unbend during movie alignment. Using the first frame as a reference, we compute the displacement of the final frame and derive two complementary strain measures: Von Mises equivalent strain, which measures distortional (shape-changing) effects; and total equivalent strain, which captures both volumetric (area-changing) and distortional components (see Materials and Methods). Both measures range from 0 to infinite, with 0 designating no deformation, and provide scalar quantities that condense a multi-dimensional strain (or stress) state to equivalent single-dimensional values.
Figure 5. presents strain maps for the example micrograph shown in Figure 3. The Von Mises (Green-Lagrange strain) map (Figure 5a) highlights a localized shear-dominated “vortex” region where strain exceeds 1%, indicating significant non-isotropic deformation, which is consistent with the rotation motion shown by the patch trajectories in Figure 3a. The total equivalent strain map (Figure 5b) shows that the total equivalent stain of this area is above 1.4%, with the rest of the field remaining below 1.2% deformation.

Magnitude of deformation correction of the micrograph shown in Figure 3a.
(a) Von Mises equivalent strain and (b) total equivalent strain.
The result in Figure 5 is based on the alignment using a grid of 12 × 8 patches, which can track the local strain patterns with fine granularity. Reducing the number of patches can smooth small-scale fluctuations and reduce apparent peak strain values but may under-sample genuine local distortions. This trade-off between patch resolution and deformation magnitude suggests that the optimal patch density may depend on sample type and exposure rate. Unbend allows users to tailor the number of patches to their specimen and exposure-fractionation scheme, optimizing alignment fidelity and desired amount of deformation correction.
Quantitative measurement of corrected motion using 2DTM
To assess improvements in preserving high-resolution signal in the motion-corrected micrographs, we searched for large ribosomal subunits (LSUs) using 2DTM, as described in the Materials and Methods section. Stronger high-resolution signal leads to both an increased number of detected targets (Figure 6a) and higher 2DTM SNR values (Figure 6b). We also compared the SNRs of the same detections present in both micrographs processed with full-frame alignment and those processed with local distortion correction. The SNR differences are shown in Figure 6c, sorted for better visualization.

Evaluation of local motion correction using Unbend across different sample types.
(a) Box plots displaying the distribution of the number of 2DTM detections per micrograph. (b) Histograms of the 2DTM SNR of detected 2DTM targets. Unbend improves the overall distribution of SNR values for all sample types. (c) 2DTM SNR difference between Unbend and Unblur. Across all sample types, Unbend led to improvements in either the number of detected targets or 2DTM SNR values, or both.
In whole-cell Mycoplasma pneumoniae samples, distortion correction resulted in a 4.2-fold increase in LSU detection (95.5 vs. 22.9 detections per image), and the mean 2DTM SNR improved by ∼3.1% (8.96 ± 0.02 vs. 8.69 ± 0.01). The low values of standard error of the mean (SEM) (0.02 and 0.01) indicate a consistent 2DTM SNR improvement. In BS-C-1 whole-cell samples, the number of LSU detections increased from 55.9 to 69.1(∼ 23.6% improvement), and the 2DTM SNR improved from 9.88 ± 0.02 to 10.42 ± 0.02 (∼5.5% improvement). For targets detected in both full-frame and local-distortion corrected micrographs, approximately 80% showed higher 2DTM SNR values after local distortion correction (Figure 6c). Of the 20% of detected targets that displayed lower 2DTM SNR values after local distortion correction, some showed a reduction of up to a factor of 2. This reduction can be attributed to the motion correction process, which optimizes an overall loss function L2(Kx, Ky) and models motion using continuous functions to avoid patch alignments dominated by noise. This suggests that there are local areas that happen to be well aligned using full-frame alignment, and that end up with an overall worse alignment when additional degrees of freedom are added during local alignment. Nevertheless, local distortion correction resulted in a 317% increase in LSU detections in Mycoplasma pneumoniae and a 24% increase for BS-C-1, with an overall 2DTM SNR improvement by 3 ∼ 5%.
For lamellae prepared from Saccharomyces cerevisiae and ER-HoxB8 cells, the mean number of LSU detections per micrograph increased from 350 to 401 (∼15% increase) in yeast samples and from 8.5 to 10.0 (∼17% increase) in mammalian samples. The mean 2DTM SNR for yeast sample improved from 10.18 ± 0.01 to 10.62 ± 0.01 (∼ 4% increase), and for mammalian samples, it increased from 10.4 ± 0.1 to 11.2 ± 0.1 (∼8% increase). As noted earlier, motion in ER-HoxB8 lamellae varies from less than 1 Å to 6 Å, contributing to a relatively larger SEM value (0.1).
Lysates generated from BS-C-1 cells showed no substantial increase in the number of LSU detections, but a 3% improvement in the 2DTM SNR was observed (from 13.84 ± 0.04 to 14.25 ± 0.04). As shown in Figure 4, cell lysates exhibit minimal local motion, and full-frame alignment is sufficient to correct for most BIM in these samples. However, small amounts of local motion may remain and this may explain the improved 2DTM SNR in 70% of the detected targets (Figure 6c).
DeCo-LACE montages
To better understand the beam-induced deformations, we analyzed a dataset of micrographs collected from lamellae of Candida albicans cells. In this dataset, lamellae of individual cells were imaged as montages (DeCo-LACE, Elferich et al., 2022). We performed motion correction of the individual exposures within these montages using either full-frame alignment or Unbend, and found that in 47 out of 82 montages, the number of detected targets increased by more than 10% (Figure 7a). This indicates that patch-based motion correction recovered signal that would otherwise have been lost to image blurring due to local deformations. In some montages, the number of detected targets was substantially higher in every exposure (Figure 7c), suggesting that these regions of the imaged lamella were generally prone to local deformations and the observed increase in the number of detected targets was not due to a few, heavily distorted, exposures.

Impact of patch-based motion correction on detection of 60S subunits in focused ion beam-milled lamellae analyzed in a large dataset.
(a) Histogram showing the percentage of increase of 60S detection in montages processed using Unbend, compared to Unblur. (b) Scatterplot of the number of detected 60S per exposure in a representative montage that did not show a substantial increase of detection after processing with Unbend, compared to Unblur. (c) Similar to panel (b), but for a representative montage with a more substantial increase of detected targets after processing with Unbend, compared to Unblur.
For the remaining 35 montages that showed less than a 10% increase in target detection, the number of detections remained approximately unchanged between full-frame and local-distortion correction (Figure 7b). While we cannot rule out that areas in these lamellae experienced local deformations that were not corrected by our algorithm, the overall similarity in the number of detections per exposure and in the 2DTM SNR of 60S targets compared to the full dataset suggests that these areas likely did not suffer from significant BIM. In fact, the mean 2DTM SNR in areas with less than a 10% increase in detections was 11.1, whereas the mean 2DTM SNR in areas with more than a 50% increase was 10.7. This suggests that patch-based motion correction recovers most, but not all signal lost to local deformation.
In summary, our data suggest that local deformation in lamellae is not uniform: for reasons that remain unclear, some lamellae remain rigid while others display local deformation. Together with the finding that, despite patch-based motion correction, the average 2DTM SNR is still higher in areas without deformation, we propose that future work aimed at uncovering the physical basis of this variability could lead to improvements in in-situ cryo-EM datasets.
Unbend runtimes
We benchmarked the runtimes of Unbend using the movie datasets analyzed in this study.
Each job was executed with 4 CPU threads on Intel Xeon Gold 5520+ processors. Table 1 summarizes the runtimes together with key parameters of the input movies and the corresponding output micrographs. The runtimes range from ∼1.5 mins to ∼12.5 mins per movie, depending primarily on the input image size and the number of frames. The most time-consuming step is the pixel-wise interpolation, which is performed on unbinned frames. This explains why larger input dimensions and higher frame numbers result in longer runtimes.
Discussion
In this work, we introduce Unbend, a cryo-EM movie alignment program that can perform local motion correction using a 3D cubic spline model. The program begins with full-frame alignment, followed by tracking of local motion via patch-based alignment. Our 3D cubic spline model is then fit to the patch motion and optimized by a summed patch-wise cross-correlation loss function, yielding refined model parameters. With this optimized model, pixel-wise shifts are calculated for each movie frame to generate the motion-corrected micrograph.
Unbend is integrated into our cisTEM software, featuring a new GUI with real-time distortion visualization. Combined with our new program shift_field_generation, pixel-wise shift fields can be generated for calculating total and Von Mises equivalent strain. These metrics quantify the extent of deformation and can serve as a reference for adapting the number and overlap of patches to avoid introducing excessive errors in the deformation model.
Model performance
We validated Unbend across diverse in-situ samples, including whole cells, lamellae, and cell lysates, and used 2DTM to quantify the improvement in high-resolution signal in the motion-corrected micrographs. Across all sample types tested, Unbend boosted 2DTM SNR by 3 ∼ 8% and the number of detected targets by up to 317%, with the largest gains observed in specimens exhibiting large local motion (whole cells and lamellae). While cell lysate showed minimal local motions, a 3% improvement in 2DTM SNR was still observed.
Equivalent-strain analysis confirmed that, apart from some samples of the M. pneumoniae dataset, correction-induced deformations remain below 1.0%, suggesting that the model improves alignment without introducing excessive errors. The strain fields showing the maximum patch shift amounts in micrographs of different samples in Figure 4 are presented in Figure 4—figure supplement 1 – 5 and summarized in Figure 4—figure supplement 6. For the M. pneumoniae sample in Figure 4—figure supplement 1, strain analysis revealed maximum Von Mises and total equivalent values exceeding 2.2% and 3.5%, respectively, consistent with plastic deformation. Comparison of the corresponding power spectra (Figure 4— figure supplement 1a,b) showed that the micrographs corrected with Unbend displayed stronger Thon rings at high spatial frequencies, confirming that the observed plastic deformation was, at least partially, accommodated.
Together, these results demonstrate that local motion correction is essential for obtaining fully motion-corrected micrographs, especially when imaging whole cells and lamellae.
Implications and limitations
Our results indicate that specimen type and preparation method strongly influence local sample motion. Whole cells often exhibit large thickness gradients that can potentially create areas of differential motion under the electron beam, while in lamellae, which are generally thinner and more homogeneous, some stress may still be present due to the milling process and residual sample inhomogeneity. The local distortion correction model is particularly beneficial in this context, as it can compensate for these localized motion artifacts, leading to more accurate particle detection and improved 2DTM SNR. Cell lysates typically show less localized motion, and full-frame alignment is sufficient for detecting most targets using 2DTM, although some residual local distortion remains detectable and correctable.
Lamellae montages collected using DeCo-LACE (Elferich et al., 2022) further revealed substantial spatial heterogeneity in the amount of local motion, indicated by the range of 2DTM detection gains from under 10% to over 50% within a single sample. We found that montages with less motion better preserve high-resolution signal, suggesting that further improvements in the motion correction model, perhaps based on a more detailed physical mechanism, may yield additional benefits. For single particle samples, which are generally thin and homogeneous, local motion is less pronounced, and full-frame alignment should be sufficient in most cases.
Therefore, they were not tested in this work.
Materials and methods
Cell culture, cell lysate and grid preparation
Adherent BS-C-1 cells were cultured as previously described by (Salgado et al., 2018). Briefly, cells were maintained at 37°C in a humidified atmosphere with 5% CO2 and grown in Dulbecco’s Modified Eagle Medium (DMEM; Invitrogen) supplemented with 10% fetal bovine serum (FBS), 1X GlutaMAX (Thermo Fisher Scientific), and 1% penicillin-streptomycin (100 U/mL penicillin and 100 µg/mL streptomycin; Thermo Fisher Scientific). For grid seeding, cells were washed twice with pre-warmed PBS and detached using trypsin-EDTA (Gibco). Cells were counted, diluted to 1 × 105 cell/ml and seeded onto fibronectin-coated (5 µg/mL in PBS) EM grids.
Double-side glow-discharged, 200-mesh gold grids with a silicon oxide support film containing 2 µm holes and 2 µm spacing (Quantifoil) were used. Prior to use, grids were cleaned by three washes with ethyl acetate and exposed to UV light under a laminar flow hood for 45 minutes. Grids were placed into 35 mm glass-bottom tissue culture dishes (MatTek) for cell growth. Cells were allowed to adhere and spread for 24–48 hours before vitrification. Each grid was inspected under an inverted light microscope to confirm appropriate cell density and carbon film integrity. We aimed for approximately one cell per mesh; grids with excessive cell clumping were excluded.
Immediately before plunge freezing, grids were washed twice with warm PBS and transferred into Minimum Essential Medium Eagle Alpha (MEMα; Sigma) supplemented with 25 mM of HEPES buffer. Grids were then rapidly moved from the incubator to a Leica GP2 cryo-plunger, excess liquid was blotted from the back side for 8 seconds, and grids were plunge-frozen into liquid ethane cooled to –184 °C.
Cell extracts were prepared from BSC-1 cells using digitonin-based semi-permeabilization. Briefly, cells were seeded in a 75 cm2 flask and cultured to confluence. After washing twice with pre-warmed PBS, the cells were detached with Trypsin-EDTA (Gibco) and collected by centrifugation at 300 × g for 4 minutes. The cell pellet was resuspended in 100 μL of semi-permeabilization buffer (25 mM HEPES, 110 mM potassium acetate, 15 mM magnesium acetate, 1 mM DTT, 0.015% digitonin, protease inhibitor cocktail (1 tablet/ 10 ml; Roche), 40 U/mL RNase In (Promega), 1 mM EGTA) and 4 °C for 5 minutes. Following centrifugation at 1,000 × g for 5 minutes, the supernatant was collected for use in grid preparation without further modification. RNA concentration was quantified prior to grid preparation as a quality control measure, with no dilution of the extract performed. Glow-discharged Quantifoil 200-mesh gold grids with a silicon oxide support film containing 2 µm holes and 2 µm spacing were used. Plunge freezing conditions used were identical to those described for whole cells.
Cryo-EM data acquisition
Cryo-EM data were collected using a Titan Krios transmission electron microscope (Thermo Fisher Scientific) operated at 300 keV, equipped with a K3 direct electron detector and an energy filter (Gatan) set to a 20 eV slit width.
For cell edge data collection, medium magnification montages were used to select vitrified cell areas that were transparent enough for cryo-EM. Images were acquired at a nominal magnification of 64,000× corresponding to a calibrated pixel size of 1.33 Å. A defocus range of –1.0 to –1.5 µm was targeted using SerialEM’s autofocus function (Mastronarde, 2005) on a sacrificial area. Movies were recorded at an exposure rate of 1.02 e−/Å per frame to a total accumulated exposure of 30.6 e−/Å.
For the cell lysate, we used a nominal magnification of 105,000× corresponding to a calibrated pixel size of 0.83 Å. We employed beam tilt to acquire multiple movies (5 per hole across nine holes) at each stage position. Zero-loss peak (ZLP) refinement was performed every 90 minutes at a unique location to avoid dark areas. Movies containing 30 frames, with an exposure of 1.0 e−/Å per frame, were recorded, resulting in a total exposure of 30 e−/Å.
2D template generation and 2D template matching
For 2DTM, 3D templates were generated from trimmed atomic models containing only the large ribosomal subunit (50S or 60S), using the simulate program (Himes & Grigorieff, 2021). Specifically, models derived from PDB entries 5LZV (for mammalian samples: BS-C-1 and ER-HoxB8), 6Q8Y (for Saccharomyces cerevisiae), and 3J9W (for Mycoplasma pneumoniae) were used. 2DTM was performed using the match_template program (Lucas et al., 2021) as implemented in cisTEM. The search was conducted with an in-plane angular step of 1.5° and an out-of-plane step of 2.5°. For whole-cell and lamella samples, and additional defocus search was conducted within ±120 nm of the estimated defocus, using 20 nm increments.
Template-matched coordinates, Euler angles, and defocus values were extracted using the MT module within the cisTEM GUI and exported as.star files. These files were subsequently analyzed to quantify the number of detected targets and the 2DTM SNR using custom Python scripts in Jupyter Notebook. The sample thickness was determined using CTFFIND5.
Von Mises equivalent strain and total equivalent strain
The Von Mises equivalent strain derives from the Von Mises criterion, widely used in engineering and mechanics to predict yielding or failure of materials subjected to complex (multiaxial) stresses or strains. The Von Mises equivalent strain effectively measures how far a material is distorted from its original shape. In our case, with the shift field {ux, uy}, we can obtain the deformation gradient F:

The Green–Lagrange strain tensor E filters out the rigid-body rotations measures the true finite strains, and can be calculated by:

The total equivalent strain combines the magnitude of all deformation modes (axial + shear) and is expressed as:

The Von Mises equivalent strain removes the volume change and only keep the shape change:

where 

δij is the Kronecker delta, and tr E is the volumetric part/trace, which represent the pure “dilation” or “compression” component that changes the area but not shape:

Data availability
Movies of samples not published previously have been deposited on EMPIAR: ER-HOXB8 cells (EMPIAR-12944); movies of BS-C-1 cell edges (EMPIAR-12943); movies of BS-C-1 cell lysate (EMPIAR-12942). The source code for Unbend is part of cisTEM and available at https://github.com/timothygrant80/cisTEM/tree/unbend; binaries for most Linux distributions can be downloaded at https://cistem.org/downloads.
Acknowledgements
The authors thank members of the Grigorieff lab for helpful discussions. We are also grateful for the use of and support from the cryo-EM facility at UMass Chan Medical School. L.K. and N.G. acknowledge funding from the Chan Zuckerberg Initiative, grant #2021-234617 (5022).
Additional information
Author contributions
Conceptualization: L.K., J.E. and N.G.; Data curation: L.K., X.Z. and J.E.; Formal analysis: L.K., X.Z. and J.E.; Funding acquisition: N.G.; Investigation: L.K., X.Z. and J.E.; Methodology: L.K., J.E., and N.G.; Project administration: L.K. and N.G.; Resources: L.K., X.Z., J.E., and N.G.; Software: L.K., J.E. and N.G.; Supervision: N.G.; Validation: L.K., X.Z., J.E. and N.G.; Visualization: L.K., X.Z., J.E. and N.G.; Writing – original draft: L.K., X.Z., J.E. and N.G.; Writing - review & editing: L.K., X.Z., J.E. and N.G.
Additional files
References
- Alignment of direct detection device micrographs using a robust Optical Flow approachJournal of Structural Biology 189:163–176https://doi.org/10.1016/j.jsb.2015.02.001Google Scholar
- Cubic and bicubic spline interpolation in PythonHAL :hal-03017566v1Google Scholar
- Nonlinear Finite Elements for Continua and StructuresWiley Google Scholar
- Beam-induced motion of vitrified specimen on holey carbon filmJournal of Structural Biology 177:630–637https://doi.org/10.1016/j.jsb.2012.02.003Google Scholar
- Movies of iceembedded particles enhance resolution in electron cryo-microscopyStructure 20:1823–1828https://doi.org/10.1016/j.str.2012.08.026Google Scholar
- Current limitations to high-resolution structure determination by single-particle cryoEMQuarterly Reviews of Biophysics 54:e4https://doi.org/10.1017/S0033583521000020Google Scholar
- In situ high-resolution cryo-EM reconstructions from CEMOVISIUCrJ 12:502–510https://doi.org/10.1107/S2052252525005196Google Scholar
- CTFFIND5 provides improved insight into quality, tilt, and thickness of TEM sampleseLife 13:RP97227https://doi.org/10.7554/eLife.97227Google Scholar
- Defocus Corrected Large Area Cryo-EM (DeCo-LACE) for label-free detection of molecules across entire cell sectionseLife 11:e80980https://doi.org/10.7554/eLife.80980Google Scholar
- Curves and surfaces for CAGD: A practical guideMorgan Kaufmann Google Scholar
- Measuring the optimal exposure for single particle cryo-EM using a 2.6 Å reconstruction of rotavirus VP6eLife 4:e06980https://doi.org/10.7554/eLife.06980Google Scholar
- cisTEM, user-friendly software for single-particle image processingeLife 7:e35383https://doi.org/10.7554/eLife.35383Google Scholar
- Mathematical Theory of PlasticityOxford University Press Google Scholar
- Cryo-TEM simulations of amorphous radiation-sensitive samples using multislice wave propagationIUCrJ 8:943–953https://doi.org/10.1107/S2052252521008538Google Scholar
- Electron counting and beam-induced motion correction enable nearatomic-resolution single-particle cryo-EMNature Methods 10:584–590https://doi.org/10.1038/nmeth.2472Google Scholar
- Locating macromolecular assemblies in cells by 2D template matching with cisTEMeLife 10:e68946https://doi.org/10.7554/eLife.68946Google Scholar
- In situ single particle classification reveals distinct 60S maturation intermediates in cellseLife 11:e79272https://doi.org/10.7554/eLife.79272Google Scholar
- Introduction to the Mechanics of a Continuous MediumPrentice-Hall Google Scholar
- Automated electron microscope tomography using robust prediction of specimen movementsJournal of Structural Biology 152:36–51https://doi.org/10.1016/j.jsb.2005.07.007Google Scholar
- Cryo-EM with sub–1 Å specimen movementScience 370:223–226https://doi.org/10.1126/science.abb7927Google Scholar
- Structure of the transporter associated with antigen processing trapped by herpes simplex viruseLife 5:e21829https://doi.org/10.7554/eLife.21829Google Scholar
- In-cell architecture of an actively transcribing-translating expressomeScience 369:554–557https://doi.org/10.1126/science.abb3758Google Scholar
- cryoSPARC: Algorithms for rapid unsupervised cryo-EM structure determinationNature Methods 14:290–296https://doi.org/10.1038/nmeth.4169Google Scholar
- Single-protein detection in crowded molecular environments in cryo-EM imageseLife 6:e25648https://doi.org/10.7554/eLife.25648Google Scholar
- Alignment of cryo-EM movies of individual particles by optimization of image translationsJournal of Structural Biology 192:188–195https://doi.org/10.1016/j.jsb.2015.08.007Google Scholar
- Visualization of Calcium Ion Loss from Rotavirus during Cell EntryJournal of Virology 92:e01327–18https://doi.org/10.1128/JVI.01327-18Google Scholar
- Beam-induced motion correction for sub-megadalton cryo-EM particleseLife 3:e03665https://doi.org/10.7554/eLife.03665Google Scholar
- Classical detection theory and the cryo-EM particle selection problemJournal of Structural Biology 145:111–122https://doi.org/10.1016/j.jsb.2003.10.025Google Scholar
- FlexAlign: An Accurate and Fast Algorithm for Movie Alignment in Cryo-Electron MicroscopyElectronics 9:1040https://doi.org/10.3390/electronics9061040Google Scholar
- Atomic resolution cryo-EM structure of beta-galactosidaseWorldwide Protein Data Bank https://doi.org/10.2210/pdb6cvm/pdb
- Real-time cryo-electron microscopy data preprocessing with WarpNature Methods 16:1146–1152https://doi.org/10.1038/s41592-019-0580-yGoogle Scholar
- MotionCor2: Anisotropic correction of beam-induced motion for improved cryo-electron microscopyNature Methods 14:331–332https://doi.org/10.1038/nmeth.4193Google Scholar
- A Bayesian approach to beam-induced motion correction in cryo-EM single-particle analysisIUCrJ 6:5–17https://doi.org/10.1107/S205225251801463XGoogle Scholar
Article and author information
Author information
Version history
- Sent for peer review:
- Preprint posted:
- Reviewed Preprint version 1:
Cite all versions
You can cite all versions using the DOI https://doi.org/10.7554/eLife.109119. This DOI represents all versions, and will always resolve to the latest one.
Copyright
© 2025, Kong et al.
This article is distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use and redistribution provided that the original author and source are credited.
Metrics
- views
- 0
- downloads
- 0
- citations
- 0
Views, downloads and citations are aggregated across all versions of this paper published by eLife.