EMAN2
|
EmIO defines I/O operations on EM image format. More...
#include <emio.h>
Classes | |
struct | EMHeader |
Public Member Functions | |
EmIO (const string &fname, IOMode rw_mode=READ_ONLY) | |
~EmIO () | |
Public Member Functions inherited from EMAN::ImageIO | |
ImageIO (const string &fname, IOMode rw) | |
virtual | ~ImageIO () |
virtual int | read_header (Dict &dict, int image_index=0, const Region *area=0, bool is_3d=false)=0 |
Read the header from an image. More... | |
virtual int | write_header (const Dict &dict, int image_index=0, const Region *area=0, EMUtil::EMDataType filestoragetype=EMUtil::EM_FLOAT, bool use_host_endian=true)=0 |
Write a header to an image. More... | |
virtual int | read_data (float *data, int image_index=0, const Region *area=0, bool is_3d=false)=0 |
Read the data from an image. More... | |
virtual int | read_data_8bit (unsigned char *data, int image_index=0, const Region *area=0, bool is_3d=false, float minval=0.0f, float maxval=0.0f) |
Read the data from an image as an 8 bit array, regardless of format. More... | |
virtual int | write_data (float *data, int image_index=0, const Region *area=0, EMUtil::EMDataType filestoragetype=EMUtil::EM_FLOAT, bool use_host_endian=true)=0 |
Write data to an image. More... | |
virtual int | read_ctf (Ctf &ctf, int image_index=0) |
Read CTF data from this image. More... | |
virtual void | write_ctf (const Ctf &ctf, int image_index=0) |
Write CTF data to this image. More... | |
virtual void | flush ()=0 |
Flush the IO buffer. More... | |
virtual int | get_nimg () |
Return the number of images in this image file. More... | |
virtual bool | is_complex_mode ()=0 |
Is this an complex image or not. More... | |
virtual bool | is_image_big_endian ()=0 |
Is this image in big endian or not. More... | |
virtual bool | is_single_image_format () const |
Is this image format only storing 1 image or not. More... | |
template<class T > | |
void | become_host_endian (T *data, size_t n=1) |
Convert data of this image into host endian format. More... | |
string | get_filename () const |
Static Public Member Functions | |
static bool | is_valid (const void *first_block, off_t file_size=0) |
static size_t | get_mode_size (char data_type) |
static int | get_machine_type () |
static int | to_em_datatype (char t) |
Public Attributes | |
DEFINE_IMAGEIO_FUNC | |
Private Types | |
enum | DataType { EM_EM_CHAR = 1 , EM_EM_SHORT = 2 , EM_EM_INT = 4 , EM_EM_FLOAT = 5 , EM_EM_COMPLEX = 8 , EM_EM_DOUBLE = 9 , EM_EM_UNKNOWN } |
enum | MachineType { EM_OS8 = 0 , EM_VAX = 1 , EM_CONVEX = 2 , EM_SGI = 3 , EM_MAC = 5 , EM_PC = 6 , EM_UNKNOWN_MACHINE } |
Private Attributes | |
EMHeader | emh |
size_t | mode_size |
DataType | mode |
bool | is_big_endian |
bool | is_new_file |
Additional Inherited Members | |
Public Types inherited from EMAN::ImageIO | |
enum | IOMode { READ_ONLY = 1 , READ_WRITE = 2 , WRITE_ONLY = 3 } |
Protected Member Functions inherited from EMAN::ImageIO | |
virtual void | init ()=0 |
Do some initialization before doing the read/write. More... | |
void | check_read_access (int image_index) |
Validate 'image_index' in file reading. More... | |
void | check_read_access (int image_index, const float *data) |
Validate 'image_index' and 'data' in file reading. More... | |
void | check_write_access (IOMode rw_mode, int image_index, int max_nimg=0) |
Validate rw_mode and image_index in file writing. More... | |
void | check_write_access (IOMode rw_mode, int image_index, int max_nimg, const float *data) |
Validate rw_mode, image_index, and data pointer in file writing. More... | |
void | check_region (const Region *area, const FloatSize &max_size, bool is_new_file=false, bool inbounds_only=true) |
Validate image I/O region. More... | |
void | check_region (const Region *area, const IntSize &max_size, bool is_new_file=false, bool inbounds_only=true) |
Validate image I/O region. More... | |
FILE * | sfopen (const string &filename, IOMode mode, bool *is_new=0, bool overwrite=false) |
Run fopen safely. More... | |
Protected Attributes inherited from EMAN::ImageIO | |
string | filename |
IOMode | rw_mode |
FILE * | file = nullptr |
bool | initialized = false |
EmIO defines I/O operations on EM image format.
EM image = header + data with (data = nx * ny * nz).
An EM image file stores 1 single 2D or 3D image.
|
private |
|
private |
Definition at line 38 of file emio.cpp.
References EM_EM_UNKNOWN, emh, is_big_endian, EMAN::ByteOrder::is_host_big_endian(), is_new_file, mode, and mode_size.
EmIO::~EmIO | ( | ) |
|
static |
|
static |
Definition at line 349 of file emio.cpp.
References EM_EM_CHAR, EM_EM_COMPLEX, EM_EM_DOUBLE, EM_EM_FLOAT, EM_EM_INT, EM_EM_SHORT, and mode.
Referenced by is_valid().
|
static |
Definition at line 95 of file emio.cpp.
References EM_EM_CHAR, EM_EM_DOUBLE, EM_OS8, EM_PC, ENTERFUNC, get_mode_size(), EMAN::ByteOrder::is_data_big_endian(), EMAN::ByteOrder::is_host_big_endian(), and EMAN::ByteOrder::swap_bytes().
Referenced by EMAN::EMUtil::fast_get_image_type(), and EMAN::EMUtil::get_image_type().
|
static |
Definition at line 302 of file emio.cpp.
References EMAN::EMUtil::EM_CHAR, EMAN::EMUtil::EM_DOUBLE, EM_EM_CHAR, EM_EM_COMPLEX, EM_EM_DOUBLE, EM_EM_FLOAT, EM_EM_INT, EM_EM_SHORT, EMAN::EMUtil::EM_FLOAT, EMAN::EMUtil::EM_FLOAT_COMPLEX, EMAN::EMUtil::EM_INT, EMAN::EMUtil::EM_SHORT, and EMAN::EMUtil::EM_UNKNOWN.
|
private |
Definition at line 99 of file emio.h.
Referenced by EmIO(), and get_mode_size().