Format of SPIDER 2D and 3D image files
SPIDER uses nsam to denote number of pixels (voxels) per
row, nrow to 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 labrec
records in the header, where labrec = ceiling of (256/nsam). Please
note that the length of the header in SPIDER images is always >=
1024 bytes and is calculated as follows (in FORTRAN) when a new
SPIDER image is created:
LENBYT = NSAM * 4
LABREC = 1024 / LENBYT
IF (MOD(1024,LENBYT) .NE. 0) LABREC = LABREC + 1
LABBYT = LABREC * 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 FORTRAN direct access unformatted file I/O
In indexed stack files the image data is also preceeded by an
additional index header. There are indxrec records in the
header, where indxrec = ceiling of (maxindx/nsam). The user must
specify a value for maxindx whenever an indexed stack file is
originally created. (For programmers attempting to write conversion
utilities, I advise them to ignore indexed stacks. They are mainly
in use at only a couple of sites with specialized large data
requirements.)
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 labrec + 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 sequence in which the information is stored in the file is as
follows:
- Records 1 --> labrec
- SPIDER header
- Records (labrec+1)--> (nrow+labrec)
- slice No. 1
- Records (nrow+labrec+1)--> (2*nrow+labrec)
- slice No. 2
- .
.
- Records ((nslice-1)*nrow+labrec+1) -> (nslice*nrow+labrec)
- slice No. nslice
- .
.
- Records (nslice*nrow+labrec+1) --> (nslice*nrow+labrec)
Layout of the SPIDER header is as follows:
Word No.
- nslice = number of slices (planes) in volume (=1 for an image)
- nrow = number of rows per slice.
- irec = total number of records (including header records) in each image of
a simple image or stacked image file.
- nhistrec = (obsolete, unused)
- iform = file type specifier. Obsolete file types d, 8, 11, 12,
16, -1, -3, -7, and -9 are no longer supported in SPIDER.
| iform |
(type) |
data type |
|
| 1 |
(r) |
2D image. |
| 3 |
(r) |
3D volume. |
| -11 |
(fo) |
2D Fourier, mixed radix odd. |
| -12 |
(fe) |
2D Fourier, mixed radix even. |
| -21 |
(fo) |
3D Fourier, mixed radix odd. |
| -22 |
(fe) |
3D 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.
- labrec = number of records in file header (label).
- iangle = flag that tilt angles are present.
- phi = tilt angle (See note #2 below).
- 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 = This position has a value of 0 in simple 2D or
3D (non-stack) files. In an "image stack" there is one overall
stack header followed by a stack of images in which each image has
its own image header. (An image stack differs from a simple 3D
image in that each stacked image has its own header.) A value of
>0 in this position in the overall stack header indicates
a stack of images. A value of <0 in this position in the
overall stack header indicates an indexed stack of images and gives
the maximum image number allowed in the index.
- NOTUSED = This position is unused now! Prior to release
9.0, a -1 at this location in an overall stack indicated a
valid stack and in the stacked images, a value of 1 indicated that
this image was in use (existed).
- maxim = This position is only used in the overall header for a
stacked image file. There, this position contains the number of the
highest image currently used in the stack. This number is updated,
if necessary, when an image is added or deleted from the
stack.
- imgnum = This position is only used in a stacked image header.
There, this position contains the number of the current image or
zero if the image is unused.
- lastindx = This position is only used in the overall header of
indexed stacks. There, this position is the highest index currently
in use.
- unused
- unused
- Kangle = flag that additional angles are present in header. 1 =
one additional rotation is present, 2 = additional rotation that
preceeds the rotation that was stored in words 15..20.
- phi1
- theta1
- psi1
- phi2
- theta2
- psi2
50-76 == reserved for Jose Maria's transforms
212-214 == cdat = character * 11 containing creation date e.g.
27-MAY-1999
215-216 -- ctim = character * 8 containing creation time e.g.
09:43:19
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#2 :
- The angle, offset & scale factor locations contained in the
SPIDER header are available to communicate between different SPIDER
operations. Currently they are NOT used in the code
distributed with SPIDER, but some outside labs make extensive use
of these positions. The angles are usually in Euler format and are given in degrees.
- Note#3 :
- SGI, most IBM, Mackintosh, and Sun Unix machines use a
different byte ordering from GNU/Linux on Intel, or HP Alpha
machines. SPIDER contains the "CP TO
OPEND" operation to interconvert these files. However SPIDER
can read/write either byte ordering now.
Source: image_doc.html
Last update: 28 Nov. 2004
ArDean Leith
©
Copyright Notice /
Enquiries: spider@wadsworth.org