HOME GUIDE OPERATIONS DOCS ERRORS FORMATS INSTALL NEW TIPS WEB SITES

Format of SPIDER 2D and 3D image files

SPIDER uses nsam to denote number of pixels (voxels) per row, nrowto denote number of rows, and nslice to denote the number of slices or planes in a volume. A 2D image is considered to be a special case of a volume consisting of a single slice (or plane).

The image data is preceeded by a header. There are headrec records in the header, where headrec = ceiling of (256/nsam). Please note that the length of the header in SPIDER images is always >= 1024 bytes and is calculated as follows when a new SPIDER image is created:

LENBYT = NSAM * 4 HEADREC = 1024 / LENBYT IF (MOD(1024,LENBYT) .NE. 0) HEADREC = HEADREC + 1 LABBYT = HEADREC * LENBYT
Where LENBYT is the record length in bytes, and the MOD function returns the remainder of dividing 1024 by LENBYT. This variable length header is used for compatibility with direct access unformatted file I/O
The image data in a volume of nsam x nrow x nslice voxels is stored in the following manner:
Unformatted, direct access file containing a total of headrec + nrow x nslice records. In a standard SPIDER image file each record contains nsam 4-byte words which are stored as floating point numbers.
The image data is no longer followed by a trailer containing records for histogram data.

The sequence in which the information is stored in the file is as follows:

Records 1 --> headrec
SPIDER header
Records (headrec+1)--> (nrow+headrec)
slice No. 1
Records (nrow+headrec+1)--> (2*nrow+headrec)
slice No. 2
.
.
Records ((nslice-1)*nrow+headrec+1) -> (nslice*nrow+headrec)
slice No. nslice
.
.
Records (nslice*nrow+headrec+1) --> (nslice*nrow+headrec)
Layout of the SPIDER header is as follows:
    Word No.
  1. nslice = number of slices (planes) in volume (=1 for an image) The value stored in the file is negative on normal VAX/VMS files. (VAX/VMS files created before 1988 had only a single record for the header, irrespective of the record length which was always nsam. For these early VAX/VMS files the first header had a positive value for nslice). The first header position on Unix SPIDER files is always the positive value of nslice since there are no short label files available on UNIX SPIDER. As of August 1996 short label files must be converted to regular files on VAX/VMS using 'CP FROM SHORT' before they can be used.
  2. nrow = number of rows per slice.
  3. irec = total number of records in the file (unused)
  4. nhistrec = (obsolete)
  5. iform = file type specifier. Currently file types d, 8, c, -, and 16 are not supported in SPIDER.
    iform (type) data type
  6. imami = maximum/minimum flag. Is set at 0 when the file is created, and at 1 when the maximum, minimum, average, and standard deviation have been computed and stored into this header record (see following locations).
  7. fmax = maximum value.
  8. fmin = minimum value.
  9. av = average value.
  10. sig = standard deviation. A value of -1.0 Indicates that sig has not been computed previously.
  11. ihist = (obsolete, no longer used).
  12. nsam = number of pixels per line.
  13. headrec = number of records in file header.
  14. iangle = flag that tilt angles have been filled.
  15. phi = tilt angle.
  16. theta = tilt angle.
  17. gamma = tilt angle (also called psi).
  18. xoff = x translation.
  19. yoff = y translation.
  20. zoff = z translation.
  21. scale = scale factor.
  22. labbyt = total number of bytes in header.
  23. lenbyt = record length in bytes.
  24. istack = indicator that file contains a stack of images.
  25. inuse = indicator that this image in stack is used (exists)
  26. maxim = max. image used in stack (in stack header only)
  27. unused
  28. unused
  29. unused
  30. unused
  31. Kangle = flag that additional angles are set. 1 = one additional rotation is present, 2 = additional rotation that preceeds the rotation that was stored in words 15..20. For details see manual chapter voceul.man
  32. phi1
  33. theta1
  34. psi1
  35. phi2
  36. theta2
  37. psi2
  38. - 50..76 reserved for Jose Maria's transforms 212-214 == cdat = character * 10 containing creation date
    215-216 -- ctim = character * 8 containing creation time
    217-256 -- ctit = character * 160 containing title

    Note#1 :
    All character arrays are retrieved from the floating point buffer array containing the header record(s) by equivalence assignments. Thus character arrays are stored in the header without any conversion.

    Note#3 :
    The number of records in the file depends on the type of file. All files have a header, and space for the image data. Fourier files may have extra record(s) needed for the Fourier.

    Note#4 :
    Prior to 1989 an obsolete file format was in use on VAX/VMS. The old short header format had a single header record. When narrow images were used a portion of the header information would be truncated and lost. The "CP FROM SHORT" command can convert an old short header image file to the current format.

    Note#5 :
    Most Unix machines use a different floating point format from VAX/VMS. SPIDER contains "CP FROM VAX" and "CP TO VAX" commands to convert a VAX/VMS SPIDER image to a Unix SPIDER image (and vice versa). Relevant source code for interconverting Unix and VAX/VMS floating point numbers is contained in vax32.f , vax32u.f, and unix32.f.


    Source: image_doc.html     Last update: 14 January 1998     ArDean Leith


    © Copyright Notice /       Enquiries: spider@wadsworth.org