Collaborative Computational Project
for Electron cryo-Microscopy

MRC

MRC/CCP4 2014 file format

This page gives the detailed specification of the MRC2014 format, as published by Cheng et al. (2015). For other versions of the MRC format and an overview of the format update process, see the parent page.

CCP-EM maintain a Python library for reading, writing and validating MRC2014 files. There is also a web server to validate files against the format specification given here.

Main header

Length = 1024 bytes, organized as 56 4-byte words followed by space for 10 80-byte text labels.
WordBytesVariable name DescriptionNote
11-4 NX number of columns in 3D data array (fast axis)1
25-8 NY number of rows in 3D data array (medium axis)
39-12 NZ number of sections in 3D data array (slow axis)
413-16 MODE 0 8-bit signed integer (range -128 to 127)
1 16-bit signed integer
2 32-bit signed real
3 transform : complex 16-bit integers
4 transform : complex 32-bit reals
6 16-bit unsigned integer
2
517-20 NXSTART location of first column in unit cell
621-24 NYSTART location of first row in unit cell
725-28 NZSTART location of first section in unit cell
829-32 MX sampling along X axis of unit cell
933-36 MY sampling along Y axis of unit cell
1037-40 MZ sampling along Z axis of unit cell3
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)4
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 value5
2181-84 DMAX maximum density value
2285-88 DMEAN mean density value
2389-92 ISPG space group number6
2493-96 NSYMBT size of extended header (which follows main header) in bytes7
25-4997-196 EXTRA extra space used for anything - 0 by default
27105 EXTTYP code for the type of extended header 8
28109 NVERSION version of the MRC format9
50-52197-208 ORIGIN phase origin (pixels) or origin of subvolume (A)10
53209-212 MAP character string 'MAP ' to identify file type
54213-216 MACHST machine stamp encoding byte ordering of data11
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 labels

Extended header

In the original definition, the extended header holds space group symmetry records 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 block

A list of data values representing the image/map/volume itself. The data type is defined by the MODE keyword in the main header (see above). The data items form a 3-dimensional grid, organised into columns, rows and sections (see keywords NX, NY, NZ in main header). The orientation of the grid with respect to the coordinate system is set by keywords MAPC, MAPR, MAPS in the main header. The 3-dimensional grid may represent a stack of images or a stack of volumes, see note above.

Notes

Note 1
The data block of an MRC format file holds a 3D array of data (of type specified by MODE). NX, NY, NZ specify the dimensions (in grid points) of this array. In EM, this will correspond to the dimensions of a volume/map, or the combined size of an image/volume stack. In crystallography, this will correspond to the dimensions of a map, which may cover a crystallographic unit cell or may cover some fraction or multiple of a unit cell.
Note 2
In the MRC2014 format, Mode 0 has been clarified as signed, and mode 6 has been added for 16-bit unsigned integer data.
Note 3
In crystallographic usage, MZ represents the number of intervals, or sampling grid, along Z in a crystallographic unit cell. This need not be the same as NZ, if the map doesn't cover exactly a single unit cell. For microscopy, where there is no unit cell, MZ represents the number of sections in a single volume. For a volume stack, NZ/MZ will be the number of volumes in the stack. For images, MZ = 1.
Note 4
In EM MAPC,MAPR,MAPS = 1,2,3 so that sections and images are perpendicular to the Z axis. In crystallography, other orderings are possible. For example, in some spacegroups it is convenient to section along the Y axis (i.e. where this is the polar axis).
Note 5
Density statistics may not be kept up-to-date for image/volume stacks, since it is expensive to recalculate these every time a new image/volume is added/deleted. We have proposed the following convention: DMAX < DMIN, DMEAN < (smaller of DMIN and DMAX), RMS < 0 each indicate that the quantity in question is not well determined.
Note 6
Spacegroup 0 implies a 2D image or image stack. For crystallography, ISPG represents the actual spacegroup. For single volumes from EM/ET, the spacegroup should be 1. For volume stacks, we adopt the convention that ISPG is the spacegroup number + 400, which in EM/ET will typically be 401.
Note 7
NSYMBT specifies the size of the extended header in bytes, whether it contains symmetry records (as in the original format definition) or any other kind of additional metadata.
Note 8
A code for the kind of metadata held in the extended header. Currently agreed values are:
CCP4Format from CCP4 suite
MRCOMRC format
SERISerialEM
AGARAgard
FEI1FEI software, e.g. EPU and Xplore3D, Amira, Avizo
Note 9
The version of the MRC format that the file adheres to, specified as a 32-bit integer and calculated as:
     Year * 10 + version within the year (base 0)
For the current format change, the value would be 20140.
Note 10
For transforms (Mode 3 or 4), ORIGIN is the phase origin of the transformed image in pixels, e.g. as used in helical processing of the MRC package. For a transform of a padded image, this value corresponds to the pixel position in the padded image of the center of the unpadded image.

For other modes, ORIGIN specifies the real space location of a subvolume taken from a larger volume. In the (2-dimensional) example shown above, the header of the map containing the subvolume (red rectangle) would contain ORIGIN = 100, 120 to specify its position with respect to the original volume (assuming the original volume has its own ORIGIN set to 0, 0).
Note 11
Bytes 213 and 214 contain 4 `nibbles' (half-bytes) indicating the representation of float, complex, integer and character datatypes. Bytes 215 and 216 are unused. The CCP4 library contains a general representation of datatypes, but in practice it is safe to use 0x44 0x44 0x00 0x00 for little endian machines, and 0x11 0x11 0x00 0x00 for big endian machines. The CCP4 library uses this information to automatically byte-swap data if appropriate, when tranferring data files between machines.