Skip to Content

Frealign: Using Density Masks

In some cases, particle alignment and/or classification can be improved by using a mask that is applied to the input reference map. Frealign provides two ways to use density masks:

  1. An external mask file can be supplied that must have the same pixel dimensions as the input reference map(s). The file name of this mask file must be supplied in the mparameters file using keyword "mask_file". Frealign (more specifically, the program, apply_mask.exe) converts this file to a binary mask by setting all pixels with values larger than 0 to 1 and all other pixels to 0. The user has the option to specify a soft cosine-shaped edge that is added to the masked region to reduce Fourier ripples (default width is 5 pixels). When the mask is applied to a reference map, density outside the masked region is normally set to 0. However, the user can also specify that the density outside the mask is not set to zero and instead weighted by a factor specified using keyword "mask_outside_weight" (in mparameters). Additionally, the outside density can be low-pass filtered using a filter limited by a cosine edge. The filter radius (resolution) is specified by keyword "mask_filt_res" and the width of the cosine edge by keyword "mask_filt_edge" (both in mparameters). The combination of density weight and low-pass filtering provides the user with a flexible way to emphasize regions in a reference map without entirely discarding the rest of the density. This may help maintain good particle alignments even in situations where the mask includes only a small part of the particle. Users are encouraged to experiment with different settings to optimize results.

  2. A spherical mask can be applied without providing a mask file by specifying the x,y,z coordinates of the center of the sphere and its radius (all in Ångstroms) using keyword "focus_mask" (in mparameters). The coordinates are measured from the corner of the reference map that is at the origin (the first voxel). A good way to determine the mask coordinates is to use IMOD’s XYZ tool: After pinpointing the center of the mask (in voxels), the coordinates to be used in Frealign are
       x_frealign = (x_imod – 1) * pix_size
       y_frealign = (y_imod – 1) * pix_size
       z_frealign = (z_imod – 1) * pix_size

    The correct location of the mask can be verified by calculating matching projections using to command frealign_calc_projections. Frealign will use the spehrical mask only to calculate LogP values that will be used for maximum-likelihood classification; the mask will not be used during particle alignment. The mask will be applied in the following way: for a given particle, a 2D reference projection will be calculated in the usual way. This projection is then masked with the projected location of the spherical mask before LogP is calculated. Therefore, only features within the projection of the spherical mask will be used for classification. This type of masking differs from an externally applied mask because it retains the projected density of regions above and below the area of interest inside the mask. This can increase the accuracy of the classification.