Estimating defocus and astigmatism of micrographs with CTFFIND3


The SPIDER procedure: mrcctf.spi reads ../sel_micrograph and ../Micrographs/raw****.
It calls loadmic.spi (a SPIDER procedure), ctffind3 (the MRC CTFFIND3 program), and, (a python script), and
creates: defocus-mrc: a SPIDER doc file of defocus and astigmatism values.


mrcctf.spi takes a micrograph in SPIDER or scanned format, windows it, creates a temporary shell script, and uses the shell script as input to the MRC program ctffind3.exe. This program generates a text report with defocus and astigmatism estimates as well as a power spectrum image. It then calls a python script (, which searches the report for the defocus and astigmatism values, and writes these out to a SPIDER document file.

Micrographs (in SPIDER format)
SPIDER parameter doc file providing
Spherical aberration
Electron beam voltage (kV)
Amplitude contrast ratio
Pixel size on scanner (microns)
Selection doc file containing micrograph numbers
Boundary for windowing edges of micrographs
Parameters for ctffind
Box size Box size for ctffind3 (must be even)
ResMin (A)
ResMax (A)
dFMin (A)
dFMax (A)

Doc file of defocus and astigmatism information
Power spectrum generated by ctffind3
Text report generated by ctffind3


Determines defocus and astigmatism for images of arbitrary size. Astigmatic angle is measured from x axis (same conventions as in the MRC 2D image processing programs).

CTFFIND3 was developed in 1998 by Nikolaus Grigorieff at the MRC Laboratory of Molecular Biology in Cambridge, The software is licensed under the terms of the GNU Public License version 3 (GPLv3). Download

Mindell, JA, Grigorieff N. 2003. Accurate determination of local defocus and specimen tilt in electron microscopy. J. Struct. Biol. 142:334-47.

1) Input file name for image
2) Output file name to check result
3) CS[mm], HT[kV], AmpCnst, XMAG, DStep[um]
4) Box, ResMin[A], ResMax[A], dFMin[A], dFMax[A], FStep

CS: Spherical aberration coefficient of the objective in mm
HT: Electron beam voltage in kV

AmpCnst: Amount of amplitude contrast (fraction). For ice images 0.07, for negative stain about 0.15.

XMAG: Magnification of original image

DStep: Pixel size on scanner in microns

Box: Tile size. The program divides image into square tiles and calculates the average power spectrum. Tiles with a significatly higher or lower variance are excluded; these are parts of the image which are unlikely to contain useful information (beam edge, film number etc). IMPORTANT: Box must have even pixel dimensions.

ResMin: Low resolution end of data to be fitted.

ResMaX: High resolution end of data to be fitted.

dFMin: Starting defocus value for grid search in Angstroms. Positive values represent an underfocus. The program performs a systematic grid search of defocus values and astigmatism before fitting a CTF to maching precision.

dFMax: End defocus value for grid search in Angstroms.

FStep: Step width for grid search in Angstroms.

1) Power spectrum generated (in SPIDER format).
This output image file can be used to check the result of the fitting. It shows the filtered average power spectrum of the input image in one half, and the fitted CTF (squared) in the other half. The two halfs should agree very well for a sucessfull fit. Example output.

2) Text report.

Searches through the CTFFIND3 report for the following lines:
19240.9118631.46 6.43 0.0137 Final Values
DFMID1 = defocus along "long" axis
DFMID2 = defocus along "short" axis
ANGAST = angle of astigmatism
CC = magnitude of astigmatism

The two defocus measures are averaged, and this information is written out to a SPIDER document file with 6 columns:
key n mic no avg defocus defocus1 defocus2 angle astig
1 6 1.000 26404.675 26446.72 26362.63 0.9400.013
The micrograph number is used as the index key. If there are gaps in the micrograph numbers, use the SPIDER operation DOC REN on the file.

Angle and magnitude of astigmatism are represented differently than in SPIDER. According to Grigorieff's web site:
Question: Is there a program to CTF correct a single image using the values obtained from ctffind3 (i.e. correction taking into account some astigmatism)?
Answer: SPIDER can do this -- you would use the "TF C" function to generate CTF with amplitudes, or "TF CT" to just generate the binary version for phase flipping. Then you would multiply the FT of your image by the result using "MU". The only tricky thing is converting the CTFFIND3 parameters to SPIDER ones, because the astigmatism angle conventions are different. The following code illustrates:
spider_defocus = (DFMID1 + DFMID2)/2;
spider_astig = (DFMID2 - DFMID1);
spider_angle_astig = ANGAST - 45;
if (spider_astig < 0)
   {spider_astig = -spider_astig;
   spider_angle_astig = spider_angle_astig + 90;}


enhancepowmrc.spi enhances the power spectrum image from CTFFIND3.

Power spectra generated by SPIDER
Power spectra generated by CTFFIND3
Selection doc file containing micrograph numbers

Enhanced Power spectra generated by ctffind3

Source: defmrc.html     Page updated: 12/10/12     Author: Bill Baxter