Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

emdata_io.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

void read_image (const string &filename, int img_index=0, bool header_only=false, const Region *region=0, bool is_3d=false)
 read an image file and stores its information to this EMData object.
void read_binedimage (const string &filename, int img_index=0, int binfactor=0, bool fast=false, bool is_3d=false)
 read in a binned image, bin while reading.
void write_image (const string &filename, int img_index=0, EMUtil::ImageType imgtype=EMUtil::IMAGE_UNKNOWN, bool header_only=false, const Region *region=0, EMUtil::EMDataType filestoragetype=EMUtil::EM_FLOAT, bool use_host_endian=true)
 write the header and data out to an image.
void append_image (const string &filename, EMUtil::ImageType imgtype=EMUtil::IMAGE_UNKNOWN, bool header_only=false)
 append to an image file; If the file doesn't exist, create one.
void write_lst (const string &filename, const string &reffile="", int refn=-1, const string &comment="")
 Append data to a LST image file.
void print_image (const string str=string(""), ostream &out=std::cout)
 Print the image data to a file stream (standard out by default).
vector< boost::shared_ptr<
EMData > > 
read_images (const string &filename, vector< int >img_indices=vector< int >(), bool header_only=false)
 Read a set of images from file specified by 'filename'.
vector< boost::shared_ptr<
EMData > > 
read_images_ext (const string &filename, int img_index_start, int img_index_end, bool header_only=false, const string &ext="")
 Read a set of images from file specified by 'filename'.


Function Documentation

void append_image const string &  filename,
EMUtil::ImageType  imgtype = EMUtil::IMAGE_UNKNOWN,
bool  header_only = false
 

append to an image file; If the file doesn't exist, create one.

Parameters:
filename The image file name.
imgtype Write to the given image format type. if not specified, use the 'filename' extension to decide.
header_only To write only the header or both header and data.

void print_image const string  str = string(""),
ostream &  out = std::cout
 

Print the image data to a file stream (standard out by default).

Parameters:
out Output stream; cout by default.
str Message string to be printed.

void read_binedimage const string &  filename,
int  img_index = 0,
int  binfactor = 0,
bool  fast = false,
bool  is_3d = false
 

read in a binned image, bin while reading.

For use in huge files(tomograms)

Parameters:
filename The image file name.
img_index The nth image you want to read.
binfactor The amout you want to bin by. Must be an integer
fast Only bin xy slice every binfactor intervals, otherwise meanshrink z
is_3d Whether to treat the image as a single 3D or a set of 2Ds. This is a hint for certain image formats which has no difference between 3D image and set of 2Ds.
Exceptions:
ImageFormatException 
ImageReadException 

void read_image const string &  filename,
int  img_index = 0,
bool  header_only = false,
const Region *  region = 0,
bool  is_3d = false
 

read an image file and stores its information to this EMData object.

If a region is given, then only read a region of the image file. The region will be this EMData object. The given region must be inside the given image file. Otherwise, an error will be created.

Parameters:
filename The image file name.
img_index The nth image you want to read.
header_only To read only the header or both header and data.
region To read only a region of the image.
is_3d Whether to treat the image as a single 3D or a set of 2Ds. This is a hint for certain image formats which has no difference between 3D image and set of 2Ds.
Exceptions:
ImageFormatException 
ImageReadException 

vector< boost::shared_ptr<EMData> > read_images const string &  filename,
vector< int >  img_indices = vector< int >(),
bool  header_only = false
[static]
 

Read a set of images from file specified by 'filename'.

Which images are read is set by 'img_indices'.

Parameters:
filename The image file name.
img_indices Which images are read. If it is empty, all images are read. If it is not empty, only those in this array are read.
header_only If true, only read image header. If false, read both data and header.
Returns:
The set of images read from filename.

Referenced by EMAN::EMUtil::get_all_attributes().

vector< boost::shared_ptr<EMData> > read_images_ext const string &  filename,
int  img_index_start,
int  img_index_end,
bool  header_only = false,
const string &  ext = ""
[static]
 

Read a set of images from file specified by 'filename'.

If the given 'ext' is not empty, replace 'filename's extension it. Images with index from img_index_start to img_index_end are read.

Parameters:
filename The image file name.
img_index_start Starting image index.
img_index_end Ending image index.
header_only If true, only read image header. If false, read both data and header.
ext The new image filename extension.
Returns:
The set of images read from filename.

void write_image const string &  filename,
int  img_index = 0,
EMUtil::ImageType  imgtype = EMUtil::IMAGE_UNKNOWN,
bool  header_only = false,
const Region *  region = 0,
EMUtil::EMDataType  filestoragetype = EMUtil::EM_FLOAT,
bool  use_host_endian = true
 

write the header and data out to an image.

If the img_index = -1, append the image to the given image file.

If the given image file already exists, this image format only stores 1 image, and no region is given, then truncate the image file to zero length before writing data out. For header writing only, no truncation happens.

If a region is given, then write a region only.

Parameters:
filename The image file name.
img_index The nth image to write as.
imgtype Write to the given image format type. if not specified, use the 'filename' extension to decide.
header_only To write only the header or both header and data.
region Define the region to write to.
filestoragetype The image data type used in the output file.
use_host_endian To write in the host computer byte order.
Exceptions:
ImageFormatException 
ImageWriteException 

Referenced by EMAN::RotateInFSProcessor::process_inplace().

void write_lst const string &  filename,
const string &  reffile = "",
int  refn = -1,
const string &  comment = ""
 

Append data to a LST image file.

Parameters:
filename The LST image file name.
reffile Reference file name.
refn The reference file number.
comment The comment to the added reference file.
See also:
lstio.h


Generated on Tue Jun 11 13:46:38 2013 for EMAN2 by  doxygen 1.3.9.1