Image Processing Software


Richard Henderson,
MRC Laboratory of Molecular Biology,
Francis Crick Avenue,
Cambridge Biomedical Campus,
Cambridge CB2 0QH
Tel: +44 1223 267000

The standard package of MRC programs is now maintained and downloadable from the UK collaborative computing project (CCP) for electron microscopy at



1 – Overview and general philosophy

The system of image processing programs developed by past and present members of the Laboratory is used in various forms worldwide for determining the structure of macromolecular assemblies. The approach has been to study specimens with some form of symmetry, such as crystals or helical and icosahedral particles. Programs suitable for many kinds of 2-D and 3-D analysis have been written. The philosophy has been to write largely stand-alone FORTRAN programs for carrying out the various steps of processing. At the present time, there are about 80 stand-alone programs, varying in length from a few lines to many thousands of lines of code. The unifying principle has been to use the standard CCP4 format (MAPFORMAT) which we call IMAGE format for images and Fourier transforms and postscript format for graphics files. These are also used in the crystallographic CCP4 system. In the later stages of some of the procedures, for example in high resolution electron crystallography, amplitudes and phases are put into a third standard format, that of MTZ format, which allows direct access to the X-ray crystallographic software in CCP4. Libraries of standard subroutines are available for reading, writing and manipulating files. A user program written to accept files in these formats and to produce output in the same three formats thus fits directly into the system, with no need for any modifications to existing structures. The libraries can be invoked at the linking step under most flavours of LINUX including MAC/OSX. We have produced FORTRAN user codes that will run under these systems without modification. IMAGE format involves each image or transform having an initial header block 1024 bytes long, which specifies the type and size of the file, the maximum, minimum and mean densities and other information. More information about IMAGE format files and the subroutines (imsubs2010) for manipulating them is given in section 5. Briefly, the imsubs2010 routines are written in FORTRAN and themselves call lower level routines for the actual reading and writing; these lower level routines are written in C. Programs producing graphical output use plot2K routines and the resulting postscript format files can be sent to a laserprinter or viewed on a terminal, using programs such as ghostscript which may be installation dependent. Thus apart from getting digitized data into the system and hard copy out, the system of programs can be used as a coherent whole, independent of the particularities of the installation.

2 – How to get started

Installation is described in /image2010/README. First build libraries and executables using a .bld file using either G77 or GFORTRAN. Binaries will then be written to /image2010/bin and all have the extension .exe

2.1 – Using existing libraries

For developing a new program, the following libraries might need to be invoked:

  • ifftlib – Fourier transform routines
  • imlib2010 – Routines for handling image format
  • genlib – Lower level routines invoked by imlib2010
  • plot2klib – Graphics routines
  • misclib – Miscellaneous routines from mtzlib, lcflib, miscsubs

2.2 – Implementation

The standalone programs, while (mostly) written in standard FORTRAN, call various subroutines which hopefully carry all the machine specific subroutines. The following will be needed, as discussed above (section 2.1):

  • ifftsub.for
  • imsubs2010.for
  • mtzlib.for
  • miscsubs.for
  • parser.for
  • plot2k.c
  • subs.for

along with the following from the CCP4 I/O library: ccp4_array.c

  • ccp4_array.h
  • ccp4_diskio_f.c
  • ccp4_errno.h
  • ccp4_file_err.h
  • ccp4_fortran.h
  • ccp4_general.c
  • ccp4_general_f.c
  • ccp4_general.h
  • ccp4_parser.c
  • ccp4_parser_f.c
  • ccp4_parser.h
  • ccp4_program.c
  • ccp4_program.h
  • ccp4_spg.h
  • ccp4_sysdep.h
  • ccp4_types.h
  • ccp4_unitcell.c
  • ccp4_unitcell.h
  • ccp4_utils.h
  • ccp4_vars.h
  • ccplib.for
  • cmtzlib.c
  • cmtzlib_f.c
  • cmtzlib.h
  • csymlib.c
  • csymlib_f.c
  • csymlib.h
  • cvecmat.c
  • cvecmat.h
  • keyparse.for
  • lcflib.for
  • library_err.c
  • library_f.c
  • library_file.c
  • library_file.h
  • library_utils.c
  • lkyasn.for
  • lkyin.for
  • mtzdata.h
  • mtzlib.for
  • parser.for
  • unix.m4

3 – Index of existing stand-alone programs

3.1 – General programs for processing micrographs:

1. BANDPASS Bandpass filters stack of images.
2. BOXIM Standard boxing program for selection of an area.
3. BOXIMAGE Similar to above, leaves boxed area in original position.
4. FFTRANS Fast Fourier transform.
5. HEADER Prints out information in header records.
6. IMEDIT General editing program for image headers
7. INTERPO General 2D re-interpolation program
8. LABEL Image handling, does a few nice things.
9. MRC2TIF Converts MRC image format to TIFF format.
10. REMORIG Remove origin peak in transform to correct background.
11. TAPEREDGEK Tapers the edge of an image to remove spikes.
12. TIF2MRC Converts TIFF format files to MRC image format.
13. TRMASK Masks transform for filtering
14. TRNOUT Output amplitudes & phases to printer.
15. TWOFILE Linear combination, or multiply/divide data in two files.

3.2 – 2-dimensional processing programs:

3.2.1 – Image Analysis:
1. EMTILT Calculate tilt angles from lattice parameters
2. MASKTRANA Masks transform for filtering, like TRMASK
3. AUTOCORRL Autocorrelation calc + expansion – use with QUADSERCH
4. QUADSERCHK Correlation peak search on lattice, with profile fit
5. CCUNBENDK Unbend image using list of peaks from QUADSERCH
6. MMBOXA Sophisticated version of NNBOX, producing Amps, phases
7. TTBOXK Corrects for tilted transfer function, gives Amps, phases
8. TTMASK Combined MASKTRAN and TTBOX, masking + TTF corr on tilted
9. TTREFINE Refines defocus, astig, tilt params on tilted images
10. CTFSEARCH Refine or search for correct defocus, astigmatism
11. CTFAPPLYK Applies CTF to data from MMBOX, with graphical output
12. CTFCALCK Computes CTF curves for chosen values of Cs, KV, Defocus
13. CTFFIND2 Determines defocus and astigmatism.
14. CTFFINDA Finds and applies CTF correction.
15. ORIGTILTK Combine data from different images using crystal symmetry
16. LATLINEK David Agard’s least squares latline fit of Amps, phases
17. ALLSPACEA Determines space group, origin, beamtilt on single image
18. AVRGAMPHS Overall averaging of amplitude and phase projection data
19. MAKETRAN Create reference transform from MTZ file – given defocus
20. SCALIMAMP3D Scales image amplitudes to selected reference data
3.2.2 – Electron diffraction patterns:
1. BACKAUTOK Calculates radial background and finds centre of pattern
2. AUTOINDEXK Finds two simplest lattice vectors automatically
3. PICKAUTOK Integrates and background corrects el.diff. spots
4. MERGEDIFF Merges e.d. data and does a host of corrections
5. AVRGFDELF Averages multiple measurements of delta-F from MERGEDIFF
6. SYNCFITP3 Fits lattice line curves to output from MERGEDIFF
7. AVRGINTENS Overall averaging of electron diffraction ints. in projection

3.3 – 3-dimensional helical programs:

1. HLXSEARCH Determine tilt and origin.
2. HLXDUMP Dumps layer line data from transform
3. HLXFIT Orientations & origins of different particles
4. HLXAVG Averages data from different particles
5. HLXFOUR Fourier program
6. HLXPROJ 2D filtered image from layer line data
7. HLXDYAD Imposes twofold normal to axis
9. HLXSEPR Separates overlapping Bessel functions
10. HLXLLOUT Graphs standard layer line data
11. HLXSIMUL Simulates image of helix
12. HLXFITT Orientations & origins of different particles

3.4 – Rotational averaging and filtering:

1. RFILTIM Rotational filtering
2. ROTAV Rotational averaging of 2D images or 3D maps about z axis.
3. IMROTRAN Rotates/translates 2D image – search to maximise correlation.

3.5 – General display programs:

1. LASERTONE General program for output of tone files.
2. LASERTEXT General program for output of text files.
3. HISTOK Makes histogram of densities in an image.
4. Ximdisp General X-Windows based display program.
5. THREED Displays 2D array as simulated 3D contoured surface.
6. SURF Calculates surface
7. LIGHT Displays 3D maps as shaded surfaces.

4 – References to published papers which describe these programs.

MRC Image Processing Programs
R.A. Crowther, R. Henderson and J.M.Smith
Journal of Structural Biology, 116, Pages 9-16 (1996)

XIMDISP – A visualization tool to aid structure determination from electron microscope images.
Judith M. Smith
Journal of Structural Biology, 125, Pages 223-228 (1999)

5 – Image data file Format

Map/Image Header Format:
Length = 1024 bytes, organized as 56 LONG words followed by space for 10 80 byte text labels.

1 NX number of columns (fastest changing in map)
2 NY number of rows
3 NZ number of sections (slowest changing in map)
data type : 0 image : signed 8-bit bytes range -128 to 127
1 image : 16-bit halfwords
2 image : 32-bit reals
3 transform : complex 16-bit integers
4 transform : complex 32-bit reals
5 NXSTART number of first column in map (Default = 0)
6 NYSTART number of first row in map
7 NZSTART number of first section in map
8 MX number of intervals along X
9 MY number of intervals along Y
10 MZ number of intervals along Z
11-13 CELLA cell dimensions in angstroms
14-16 CELLB cell angles in degrees
17 MAPC axis corresp to cols (1,2,3 for X,Y,Z)
18 MAPR axis corresp to rows (1,2,3 for X,Y,Z)
19 MAPS axis corresp to sections (1,2,3 for X,Y,Z)
20 DMIN minimum density value
21 DMAX maximum density value
22 DMEAN mean density value
23 ISPG space group number 0 or 1 (default=0)
24 NSYMBT number of bytes used for symmetry data (0 or 80)
25-49 EXTRA extra space used for anything – 0 by default
50-52 ORIGIN origin in X,Y,Z used for transforms
53 MAP character string ‘MAP ‘ to identify file type
54 MACHST machine stamp
55 RMS rms deviation of map from mean density
56 NLABL number of labels being used
57-256 LABEL(20,10) 10 80-character text labels

Symmetry records follow – if any – stored as text as in International Tables, operators separated by and grouped into ‘lines’ of 80 characters (ie. symmetry operators do not cross the ends of the 80-character ‘lines’ and the ‘lines’ do not terminate in a).

Data records follow.