Differences between revisions 27 and 28
Revision 27 as of 2011-09-09 02:36:08
Size: 5141
Editor: SteveLudtke
Comment:
Revision 28 as of 2011-09-09 02:36:29
Size: 5183
Editor: SteveLudtke
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
||Amira ||am ||Y ||Y ||Y ||N ||N || ||
||DF3 ||df3 ||Y ||Y ||Y ||N ||N ||File format for POV-Ray, support 8,16,32 bit integer per pixel ||
||EM ||em ||Y ||Y ||Y ||N ||Y ||As produced by the EM software package||
||EMIM ||emim ||Y ||N ||Y ||Y ||N ||images in stack are homogenous ||
||FITS ||fts ||Y ||N ||Y ||N ||N ||common file format in astronomy ||
||Gatan DM2||dm2 ||Y ||N ||N ||N ||N || ||
||Gatan DM3||dm3 ||Y ||N ||N ||N ||N || ||
Line 6: Line 13:
||ICOS ||icos ||Y ||Y ||Y ||N ||Y || ||
||Imagic ||img/hed ||Y ||Y ||Y ||Y ||Y ||seperate header and data file, cannot store multiple 3D images in one file. Regional I/O is only available for 2D. The Imagic format in EMAN2 is fully compatible with Imagic4D standard since the 2.0 release. ||
||JPEG ||jpg/jpeg ||N ||Y ||N ||N ||N ||lossy data compression ||
||LST ||lst ||Y ||Y ||Y ||Y ||N ||ASCII file contains a list of image file names and numbers. Used in EMAN1 to avoid large files. Not commonly used in EMAN2 ||
||LSTFAST ||lsx/lst ||Y ||Y ||Y ||Y ||N ||Optomized version of LST ||
Line 7: Line 19:
||Spider ||spi ||Y ||Y ||Y ||Y ||Y ||To read the overall image header in a stacked spider file, use image_index = -1. ||
||Imagic ||img/hed ||Y ||Y ||Y ||Y ||Y ||seperate header and data file, cannot store multiple 3D images in one file. Regional I/O is only available for 2D. The Imagic format in EMAN2 is fully compatible with Imagic4D standard since the 2.0 release. ||
||DM3 ||dm3 ||Y ||N ||N ||N ||N || ||
||TIFF ||tiff/tif ||Y ||Y ||N ||N ||N ||8bit or 16bit per pixel ||
Line 13: Line 21:
||VTK ||vtk ||Y ||Y ||Y ||N ||N || ||
Line 16: Line 23:
||ICOS ||icos ||Y ||Y ||Y ||N ||Y || ||
||EMIM ||emim ||Y ||N ||Y ||Y ||N ||images in stack are homogenous ||
||Gatan2 ||dm2 ||Y ||N ||N ||N ||N || ||
||Amira ||am ||Y ||Y ||Y ||N ||N || ||
||SITUS ||situs ||Y ||Y ||Y ||N ||N ||Situs-specific ASCII format on a cubic lattice. Used by Situs programs ||
||Spider ||spi ||Y ||Y ||Y ||Y ||Y ||To read the overall image header in a stacked spider file, use image_index = -1. ||
||TIFF ||tiff/tif ||Y ||Y ||N ||N ||N ||8bit or 16bit per pixel ||
||V4L ||v4l ||Y ||N ||N ||N ||N ||Acquires images from the V4L2 interface in real-time(video4linux). ||
||VTK ||vtk ||Y ||Y ||Y ||N ||N || ||
Line 21: Line 29:
||EM ||em ||Y ||Y ||Y ||N ||Y || ||
||V4L ||v4l ||Y ||N ||N ||N ||N ||Acquires images from the V4L2 interface in real-time(video4linux). ||
||JPEG ||jpg/jpeg ||N ||Y ||N ||N ||N ||lossy data compression ||
||FITS ||fts ||Y ||N ||Y ||N ||N ||common file format in astronomy ||
||LST ||lst ||Y ||Y ||Y ||Y ||N ||ASCII file contains a list of image file names and numbers. Used in EMAN1 to avoid large files. Not commonly used in EMAN2 ||
||LSTFAST ||lsx/lst ||Y ||Y ||Y ||Y ||N ||Optomized version of LST ||
||DF3 ||df3 ||Y ||Y ||Y ||N ||N ||File format for POV-Ray, support 8,16,32 bit integer per pixel ||
||SITUS ||situs ||Y ||Y ||Y ||N ||N ||Situs-specific ASCII format on a cubic lattice. Used by Situs programs ||

Table of supported image formats in EMAN2

Type

Extension

Read

Write

3D

stack

Regional I/O

Comments

Amira

am

Y

Y

Y

N

N

DF3

df3

Y

Y

Y

N

N

File format for POV-Ray, support 8,16,32 bit integer per pixel

EM

em

Y

Y

Y

N

Y

As produced by the EM software package

EMIM

emim

Y

N

Y

Y

N

images in stack are homogenous

FITS

fts

Y

N

Y

N

N

common file format in astronomy

Gatan DM2

dm2

Y

N

N

N

N

Gatan DM3

dm3

Y

N

N

N

N

HDF5

hdf

Y

Y

Y

Y

Y

This is the only format supporting the full metadata model used in EMAN2. That is, this is the only format you can export data from the database into and preserve all of the information about each image. Technically it can also support different sized images in the same stack, though this behavior is not normally used.

ICOS

icos

Y

Y

Y

N

Y

Imagic

img/hed

Y

Y

Y

Y

Y

seperate header and data file, cannot store multiple 3D images in one file. Regional I/O is only available for 2D. The Imagic format in EMAN2 is fully compatible with Imagic4D standard since the 2.0 release.

JPEG

jpg/jpeg

N

Y

N

N

N

lossy data compression

LST

lst

Y

Y

Y

Y

N

ASCII file contains a list of image file names and numbers. Used in EMAN1 to avoid large files. Not commonly used in EMAN2

LSTFAST

lsx/lst

Y

Y

Y

Y

N

Optomized version of LST

MRC

mrc

Y

Y

Y

N

Y

Note that some programs will treat 3D MRC files as stacks of 2D imagess (like IMOD). This behavior is partially supported in EMAN, but be aware that it is impossible to store metadata about each image in the stack when doing this, so it is not suitable as an export format for single particle work.

PGM

pgm

Y

Y

N

N

N

8 bits per pixel

PIF

pif

Y

Y

Y

Y

N

images in PIF stack are homogenous. PIF doesn't currently work.

PNG

png

Y

Y

N

N

N

lossless data compression, 8 bit or 16 bit per pixel

SAL

hdr/img

Y

N

N

N

N

seperate header and data file

SITUS

situs

Y

Y

Y

N

N

Situs-specific ASCII format on a cubic lattice. Used by Situs programs

Spider

spi

Y

Y

Y

Y

Y

To read the overall image header in a stacked spider file, use image_index = -1.

TIFF

tiff/tif

Y

Y

N

N

N

8bit or 16bit per pixel

V4L

v4l

Y

N

N

N

N

Acquires images from the V4L2 interface in real-time(video4linux).

VTK

vtk

Y

Y

Y

N

N

XPLOR

xplor

Y

Y

Y

N

N

8 bytes integer, 12.5E float ASCII format

Saving EMData from Python

If you want to be prompted to supply a image name using a standard dialog use this approach

   1 # save a single image
   2 a = test_image()
   3 from emsave import save_data
   4 save_data(a)
   5 
   6 # save a list of images as a stack
   7 b = test_image(2)
   8 save_data([a,b])

Regional I/O

Regional I/O means you can read/write a part of an image from/to a image file. This is useful when you process a huge image file on a computer with limited resource. The region specification is the same as in EMData::get_clip() function. For regional reading, you can specify a region inside an image, partially out of image bounds, or even completely out of image bounds. For regional writing, the region must be completely inside image bounds. You need be aware when reading a partially out of bounds region from HDF5 file, it will involve copying the inbound part image to the region size memory. That means there is a performance overhead for partially out bounds region reading.

   1 # Read a origin at (1,1,1), size 8x8x8 subregion from an 64x64x64 image file 3dimage.hdf
   2 img = EMData
   3 region = Region(1,1,1,8,8,8)
   4 img.read_image("3dimage.hdf",0,False,region)

Storage type for MRC

Pixel size of image data inside EMAN2 is float. For MRC image, by default it's writed as float (4bytes/32bit). EMAN2 also support writing short (2bytes/16bit) MRC and byte (8bit) MRC.

img = EMData(128,128)
img.write('float-image.mrc')  #by default, image will be write as float
img.write_image('short-image.mrc', 0, EMUtil.ImageType.IMAGE_MRC, False, None, EMUtil.EMDataType.EM_SHORT) #write mrc file in short (16bit)
img.write_image('byte-image.mrc', 0, EMUtil.ImageType.IMAGE_MRC, False, None, EMUtil.EMDataType.EM_UCHAR) #write mrc file in byte (8bit)

In the last write_image() funciton call, 'byte-image.mrc' is the file name you write to. Second argument, 0 is the image index in a stack. It's always 0 since MRC does not support stack. third argument, EMUtil.ImageType.IMAGE_MRC is the file type you are writing to, type 'help(EMUtil.ImageType)' in python will print out all type supported by EMAN2. forth argument, False means NOT header only. fifth argument, None means we are not doing Region I/O. sixth argument, EMUtil.EMDataType.EM_UCHAR specify the data storage type for this image file. type 'help(EMUtil.EMDataType)' will list all datatypes. For MRC, three types are supported.

EMAN2/ImageFormats (last edited 2024-02-01 04:08:01 by SteveLudtke)