EMAN2
|
Go to the source code of this file.
Functions | |
void | _read_image (ImageIO *imageio, int img_index=0, bool header_only=false, const Region *region=0, bool is_3d=false) |
This file is a part of "emdata.h", to use functions in this file, you should "#include "emdata.h", NEVER directly include this file. More... | |
void | _write_image (ImageIO *imageio, 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) |
void | read_image (const string &filename, int img_index=0, bool header_only=false, const Region *region=0, bool is_3d=false, EMUtil::ImageType imgtype=EMUtil::IMAGE_UNKNOWN) |
read an image file and stores its information to this EMData object. More... | |
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. More... | |
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. More... | |
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. More... | |
void | write_lst (const string &filename, const string &reffile="", int refn=-1, const string &comment="") |
Append data to a LST image file. More... | |
static vector< std::shared_ptr< EMData > > | read_images (const string &filename, vector< int > img_indices=vector< int >(), EMUtil::ImageType imgtype=EMUtil::IMAGE_UNKNOWN, bool header_only=false) |
Read a set of images from file specified by 'filename'. More... | |
static bool | write_images (const string &filename, vector< std::shared_ptr< EMData > > imgs, EMUtil::ImageType imgtype=EMUtil::IMAGE_UNKNOWN, bool header_only=false, const Region *region=nullptr, EMUtil::EMDataType filestoragetype=EMUtil::EM_FLOAT, bool use_host_endian=true) |
Write a set of images to file specified by 'filename'. More... | |
ostream & | operator<< (ostream &out, const EMData &obj) |
|
private |
This file is a part of "emdata.h", to use functions in this file, you should "#include "emdata.h", NEVER directly include this file.
|
private |
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.
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. |
friend ostream & operator<< | ( | ostream & | out, |
const EMData & | obj | ||
) |
void EMData::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)
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. |
ImageFormatException | |
ImageReadException |
Definition at line 124 of file emdata_io.cpp.
References EMAN::EMData::attr_dict, EMAN::EMUtil::close_imageio(), EMAN::EMUtil::em_memcpy(), EMAN::EMData::EMData(), ENTERFUNC, EMAN::Dict::erase(), EXITFUNC, get_data(), EMAN::EMUtil::get_imageio(), EMAN::Dict::has_key(), ImageFormatException, ImageReadException, EMAN::ImageIO::is_complex_mode(), EMAN::EMData::nx, EMAN::EMData::ny, EMAN::EMData::nz, EMAN::ImageIO::read_header(), EMAN::ImageIO::READ_ONLY, EMAN::EMData::save_byteorder_to_dict(), set_complex(), set_fftodd(), set_fftpad(), set_ri(), set_size(), and update().
void read_image | ( | const string & | filename, |
int | img_index = 0 , |
||
bool | header_only = false , |
||
const Region * | region = 0 , |
||
bool | is_3d = false , |
||
EMUtil::ImageType | imgtype = EMUtil::IMAGE_UNKNOWN |
||
) |
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.
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. |
ImageFormatException | |
ImageReadException |
|
static |
Read a set of images from file specified by 'filename'.
Which images are read is set by 'img_indices'.
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. |
Referenced by EMAN::EMUtil::get_all_attributes().
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.
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. |
ImageFormatException | |
ImageWriteException |
Referenced by bispecRotTransInvDirect(), bispecRotTransInvN(), EMAN::RotateInFSProcessor::process_inplace(), and write_lst().
|
static |
Write a set of images to file specified by 'filename'.
Which images are written is set by 'imgs'.
filename | The image file name. |
imgs | Which images are written. |
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. |
void EMData::write_lst | ( | const string & | filename, |
const string & | reffile = "" , |
||
int | refn = -1 , |
||
const string & | comment = "" |
||
) |
Append data to a LST image file.
filename | The LST image file name. |
reffile | Reference file name. |
refn | The reference file number. |
comment | The comment to the added reference file. |
Definition at line 361 of file emdata_io.cpp.
References EMAN::EMData::attr_dict, ENTERFUNC, EXITFUNC, EMAN::EMUtil::IMAGE_LST, and write_image().