Collaborative Computational Project
for Electron cryo-Microscopy

MRC

MRC/CCP4 2000 file format (old)

Please note that this format definition has been superceded by MRC/CCP4 2014.

Here is the original MRC/CCP4 format agreed in 1982 (with the exception of the machine stamp which was agreed a little later). The description is taken from http://www2.mrc-lmb.cam.ac.uk/research/locally-developed-software/image-processing-software/#image. See below for a list of known variations on the this format.

WordBytesVariable name DescriptionVariation
11-4 NX number of columns (fastest changing in map)
25-8 NY number of rows
39-12 NZ number of sections (slowest changing in map)
413-16 MODE 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
A
517-20 NXSTART number of first column in map (Default = 0)
621-24 NYSTART number of first row in map
725-28 NZSTART number of first section in map
829-32 MX number of intervals along X
933-36 MY number of intervals along Y
1037-40 MZ number of intervals along Z
11-1341-52 CELLA cell dimensions in angstroms
14-1653-64 CELLB cell angles in degrees
1765-68 MAPC axis corresp to cols (1,2,3 for X,Y,Z)
1869-72 MAPR axis corresp to rows (1,2,3 for X,Y,Z)
1973-76 MAPS axis corresp to sections (1,2,3 for X,Y,Z)
2077-80 DMIN minimum density value
2181-84 DMAX maximum density value
2285-88 DMEAN mean density value
2389-92 ISPG space group numberB
2493-96 NSYMBT number of bytes used for symmetry dataC
25-4997-196 EXTRA extra space used for anything - 0 by defaultD,E,F
50-52197-208 ORIGIN origin in X,Y,Z (pixel units) used for Fourier transforms (modes 3 and 4)G
53209-212 MAP character string 'MAP ' to identify file type
54213-216 MACHST machine stamp
55217-220 RMS rms deviation of map from mean density
56221-224 NLABL number of labels being used
57-256225-1024 LABEL(20,10) 10 80-character text labelsH
Length = 1024 bytes, organized as 56 4-byte words followed by space for 10 80-byte 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.

Details and variations for specific header lines

A
There is some confusion as to whether Mode 0 is signed or unsigned bytes, although the consensus appears to be for signed ("keep mode 0 output ... signed as IMOD now also does that").
Mode 1 is expected to be signed 2-byte integers.
CCP4 added MODE 5. Despite this, CCP4 uses only mode 0 (for masks) and mode 2 (for electron density maps). There is suggestion that mode 5 is unsigned 8-bit (with mode 0 as signed version).
Mode 6 was added for UCSFtomo by David Agard, and corresponds to unsigned 2-byte integers. David Mastronarde then added it to IMOD to support reconstruction from data acquired from UCSFtomo.
For light microscopy, there is a mode 7 for 4-byte signed integer (David Agard).
IMOD also has a mode 16 (unsigned char * 3) for RGB data.
B
Spacegroup 0 implies a 2D image or image stack. Some crystallography programs may complain about the non-existent spacegroup 0, but the CCP4 library has been changed to accept this. Spacegroup 1 may be used for a 3D volume (P1). There is a query over how to represent a volume stack ("4D" data). Crystallographic map files will have a standard spacegroup number here, between 1 and 230, or one of a set of pre-defined numbers representing non-standard spacegroup settings.
C
This field is meant to specify the size of the symmetry block which follows word 256, which in that case may be 0 or a multiple of 80. It is used by FEI and by IMOD to declare the size of an extended header.
D
CCP4 uses words 25-37 for defining skew planes.
E
David Agard reports a format for light microscopy that uses words 25-55 for additional information. This uses the EXTRA block, but also overwrites "MAP" string and machine stamp.
F
IMOD uses the EXTRA block, and as of version 2.6.20 is compatible with MRC format, in that it doesn't overwrite the machine stamp (see IMOD documentation). The contents of the extended header are indicated by two shorts nint and nreal at word 33 of the EXTRA block. The EXTRA data includes an imodStamp (word 39) to indicate that the file was written by IMOD.
G
IMOD/EMAN/Chimera have alternative usage where the ORIGIN specifies the location of a subvolume taken from a larger volume.
H
FEI software adds "Fei" as the first label.

Known and documented variants

IMOD
See IMOD documentation. IMOD supports two sub-formats (for input tomography tilt series and aligned images):
  • UCSFtomo (Agard) format, extended header is a series of 4-byte integers then real numbers
  • SerialEM format, extended header is a series of short integers. For example, these could contain a series of tilt angles for the image stack.
Tomograms produced by IMOD (.rec files) do not have an extended header. Files written by IMOD have the imodStamp (word 39) set, but this may not apply to the input image stacks (only added to SerialEM very recently).
FEI
The EPU package outputs 3 files per image: a small version of the image in jpeg format, an XML file containing parameters of the data acquisition, and the data image as an "extended MRC" file. Remco Schoenmakers has supplied a format description of the latter, but not sure if this is publically available.
GATAN
Digital Micrograph (the Gatan camera software) produces MRC Image files (dm4 format) that are unreadable by the Image2010 library. In fact, they follow the IMOD convention (at least for tomography stacks).
XMIPP
Formats are described here. A message to 3dem stated that from version 3.1 (not released at time of writing), xmipp will handle MRC files as follows:
  • header word 10th: MZ, equal to 1 if stack, MZ=NZ if volume
  • header word 23rd: ISPG 0-> image/stack, 1 -> volume, 401 -> volume/stack
IVE
IVE (Image Visualization environment) is the core set of software libraries that are the foundation for the tools in Priism, for 3D wide-field optical microscopy and EM tomography. IVE images are stored using the Imsubs image file format, derived from the "MRC" file format.

Proposed extensions

Here are some extensions to the MRC format proposed by developers of EM software. They are listed here for convenience, but this is not in any way a formal proposal!

  1. Adopt mode 6 corresponding to unsigned 2-byte integers. However, there is a potential conflict with an internal mode 6 in the CCP4 and MRC libraries, which corresponds to signed 4-byte integers. File mode 6 could be mapped to internal mode 1 in the CCP4 libraries. I don't think any of the low level i/o cares whether it is signed or unsigned - that is a matter for the calling programs?
  2. Use spacegroup+400 to represent a volume stack ("4D" data). Typically a stack of EM volumes will be assigned ISPG 401. For a volume stack, MZ remains the number of intervals along Z for a single volume (so that NZ = MZ * number of volumes).
    Type of dataISPGNZMZ
    Single image011
    Image stack0n1
    Single volume1mm
    Volume stack401n * mm
  3. Extended sections of metadata need to be identified robustly, especially if they overwrite sections with established meanings such as the symmetry records. Propose:
    • A 4-character string EXTTYP at word 27 to designate a derived format. CCP4 will check for known formats, and then check to see if skew plane information is located here. Allowed values for EXTTYP are (first two should be the same):
      EXTTYPmeaning
      CCP4CCP4 format
      MRCOoriginal MRC format
      SERISerialEM
      AGARAgard format
      EPUIImage format from EPU
    • NSYMBT at word 24 remains the length of the extended header, whether it contains symmetry records (as in the original MRC format) or a software-specific extension. NSYMBT is used to find the beginning of the data block, so it should only be 0 if there is nothing between the LABEL lines and the data records.
    • ISPG may be used as additional guidance, as a pragmatic measure until word 27 is established.
  4. Statistical parameters of the density values in the image/map are recorded in the header in Word 20 (DMIN), 21 (DMAX), 22 (DMEAN), and 55 (RMS). While these values are expected to be accurate for a single image or volume, they are often undetermined or inaccurately determined for large image and volume stacks since tracking of the changes in these statistics is time-consuming, especially when members of the stack are deleted or inserted. Special conditions e.g. DMAX < DMIN can be used to indicate that values are not determined.
  5. The version of the MRC format that a file adheres to should be recorded in the header. It has been suggested to use Word 28 for this.