PIL reads and writes SPIDER image files of 32-bit floating point data (“F;32F”).
PIL also reads SPIDER stack files containing sequences of SPIDER images. The seek and tell methods are supported, and random access is allowed.
The open method sets the following attributes:
- Set to ‘SPIDER’
- Set to 1 if the file is an image stack, else 0.
- Set to the number of images in the stack.
A convenience method, convert2byte, is provided for converting floating point data to byte data (mode “L”):
im = Image.open('image001.spi').convert2byte()
Writing files in SPIDER format
The extension of SPIDER files may be any 3 alphanumeric characters. Therefore the output format must be specified explicitly: