Tutorial: Dynamic Masking in Refinements (v5.0+)
This guide page covers automatic masking in Homogeneous, Non-Uniform, and Heterogeneous refinement jobs created in CryoSPARC versions beginning with v5.0. Older versions of CryoSPARC use an automatic masking algorithm not described here.
Masking During Refinement
3D Refinements require two masks:
a refinement mask, used during each refinement iteration to remove extraneous density from the current 3D volume which would otherwise degrade particle alignment, and
a resolution mask, used to separate target molecule density from solvent during FSC calculation so that the resulting resolution estimate reflects the quality of the target density rather than the background
CryoSPARC automatically generates resolution masks during refinement. It also automatically generates a refinement mask if one was not provided by the user. It is important that both masks be appropriately tight, i.e. not too tight, masking too close to target molecule density. It is also important that the masks be appropriately soft, i.e. transitioning smoothly from completely erasing density (mask has value 0.0) to completely retaining density (mask has value 1.0). Masks that are too tight or too hard can lead to refinements where spurious features develop in the density during refinement and/or FSC resolution is overestimated. Users should always inspect both the refinement mask and the resolution mask from a refinement job to confirm that they are not too tight (cutting into the density) or too hard (creating a sharp edge). The high resolution phase randomization diagnostic can also be used to detect when a mask is too tight or hard.
In CryoSPARC versions before v5.0, automatic masks were generated in refinement jobs based on user-adjustable looseness and softness parameters. These parameters were held fixed during refinement iterations. In some cases, especially for cryo-EM datasets reaching only low or intermediate resolutions (e.g. 4Å or coarser), the default parameters could produce masks that were too tight or too hard.
CryoSPARC v5.0 introduces a new mask generation method (described below) that is robust across a wide range of resolutions and produces appropriate refinement results and resolution estimates without users having to tune masking parameters. The most significant improvement introduced by the new method is to scale the mask's tightness and softness based on the 3D map's current resolution estimate, rather than using a fixed value over iterations.
Dynamic masking in CryoSPARC v5.0+
In this section we walk step-by-step through the process by which CryoSPARC produces masks. This process applies to both refinement and resolution masks. Here we create a refinement mask.
Consider this 3D map at the end of a particular iteration of a refinement:

First, we binarize the map. The threshold used is the maximum value in the map times the Dynamic mask threshold parameter. This has a default value of 0.2 for the refinement mask, but can be changed by the user. The resolution mask uses a fixed value of 0.5. This produces a map with either a zero or one in every voxel.

Next, the map is dilated by a number of voxels equal to the current resolution times the Dynamic mask near multiplier. This has a default value of 2.0 for the refinement mask, but can be changed by the user. The resolution mask uses a fixed value of 2.0.

The dilation step creates a mask that is appropriately loose, but it is still has a completely hard edge — voxels are either 1.0 or 0.0. We therefore add a soft edge, which falls gradually from a value of 1.0 at the distance determined by the Dynamic mask near multiplier, to a value of 0.0 at the distance determined by the Dynamic mask far multiplier. The width of this soft edge is thus equal to the current resolution multiplied by the difference between the far and near multipliers. The value of the Dynamic mask far multiplier is 5.0 by default in refinements, and is fixed to 5.0 for resolution masks.

Now the mask is dilated and soft, as required for refinement masks. When we plot these masks, it’s best to see the underlying volume so that you can ensure that the relevant portions of the volume are contained within the mask. We could simply display the masked volume:

But this would hide any density outside the mask which you may wish to see. For example, faint density near the target might indicate a binding partner. If that density was too faint to be included in the initial binarized mask, it would not appear in the masked volume. To avoid this scenario, we instead plot the unmasked map, but with overlays indicating where the mask has a value of 1.0 (solid lines) and where the soft edge ends (that is, where the mask has a value of 0.0; dashed line).

The region outside the dashed line is slightly shaded to focus the eye on the region inside the mask, but it is still visible to aid downstream analyses of regions outside the automatic mask.
Note that both the dilation and padding width depend on resolution. When a map is poor, the mask is therefore very wide and soft. This reduces the possibility of the mask introducing spurious information into the map. As GSFSC resolution improves during refinement, the mask tightens automatically.




Throughout the examples above, we have been plotting a single mask. CryoSPARC refinements plot both the refinement and resolution masks in the same image, and indicate which is which using the same name as the mask output.

Last updated