
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.
- 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.
- nrow = number of rows per slice.
- irec = total number of records in the file (unused)
- nhistrec = (obsolete)
- iform = file type specifier. Currently file types
d, 8, c, -, and 16 are not supported in SPIDER.
iform (type) data type
- 1 (r) 2-d image.
- 3 (r) 3-d volume.
- 8 (8) 8 bit black and white. (Sterecon only)
- 11 (c) 8 bit color. (Sterecon only)
- 12 (-) 8 bit runlength black and white. (Sterecon only)
- 16 (16) 16 bit black and white. (Sterecon only)
- -1 (f) 2-d Fourier transform.
- -3 (f) 3-d Fourier transform.
- -7 (q) 3-d Fourier transform, Paul's format.
- -9 (s) 3-d simple Fourier (Michael's format).
- -11 (fo) 2-d Fourier, mixed radix odd.
- -12 (fe) 2-d Fourier, mixed radix even.
- 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).
- fmax = maximum value.
- fmin = minimum value.
- av = average value.
- sig = standard deviation. A value of -1.0 Indicates
that sig has not been computed previously.
- ihist = (obsolete, no longer used).
- nsam = number of pixels per line.
- headrec = number of records in file header.
- iangle = flag that tilt angles have been filled.
- phi = tilt angle.
- theta = tilt angle.
- gamma = tilt angle (also called psi).
- xoff = x translation.
- yoff = y translation.
- zoff = z translation.
- scale = scale factor.
- labbyt = total number of bytes in header.
- lenbyt = record length in bytes.
- istack = indicator that file contains a stack of images.
- inuse = indicator that this image in stack is used (exists)
- maxim = max. image used in stack (in stack header only)
- unused
- unused
- unused
- unused
- 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
- phi1
- theta1
- psi1
- phi2
- theta2
- psi2
- - 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