|
EMAN2
|
A LSX file is a high performance ASCII file that contains a list of image numbers and file names. More...
#include <lstfastio.h>


Public Member Functions | |
| LstFastIO (const string &fname, IOMode rw_mode=READ_ONLY) | |
| ~LstFastIO () | |
| bool | is_single_image_format () const |
| Is this image format only storing 1 image or not. More... | |
| int | get_nimg () |
| Return the number of images in this image file. More... | |
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 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... | |
| 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) |
Public Attributes | |
| DEFINE_IMAGEIO_FUNC | |
Private Member Functions | |
| int | calc_ref_image_index (int image_index) |
Private Attributes | |
| bool | is_big_endian |
| int | nimg |
| unsigned int | line_length |
| unsigned int | head_length |
| ImageIO * | imageio |
| string | ref_filename |
| int | last_lst_index |
| int | last_ref_index |
Static Private Attributes | |
| static const char * | MAGIC = "#LSX" |
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 |
A LSX file is a high performance ASCII file that contains a list of image numbers and file names.
Each line of a LSX file has the following format: after the #LSX magic number are 2 lines, the second line containing
Denoting the length of each line in the file. If writing additional lines to the file, this length must not be exceeded.
Additional '#' comment lines are NOT permitted within the file
lines have the form: reference_image_index reference-image-filename comments
Definition at line 54 of file lstfastio.h.
Definition at line 52 of file lstfastio.cpp.
References imageio, is_big_endian, EMAN::ByteOrder::is_host_big_endian(), last_lst_index, last_ref_index, nimg, and ref_filename.
| LstFastIO::~LstFastIO | ( | ) |
Definition at line 63 of file lstfastio.cpp.
References EMAN::ImageIO::file, imageio, and ref_filename.
|
private |
Definition at line 138 of file lstfastio.cpp.
References EMAN::ImageIO::file, FileAccessException, EMAN::ImageIO::filename, EMAN::EMUtil::get_imageio(), head_length, imageio, EMAN::Util::is_file_exist(), last_lst_index, last_ref_index, line_length, LOGERR, ref_filename, and EMAN::ImageIO::rw_mode.
|
virtual |
Return the number of images in this image file.
Reimplemented from EMAN::ImageIO.
Definition at line 235 of file lstfastio.cpp.
References EMAN::ImageIO::init(), and nimg.
|
inlinevirtual |
Is this image format only storing 1 image or not.
Some image formats like MRC only store 1 image in a file, so this function returns 'true' for them. Other image formats like IMAGIC/HDF5 may store mutliple images, so this function returns 'false' for them.
Reimplemented from EMAN::ImageIO.
Definition at line 63 of file lstfastio.h.
|
static |
Definition at line 111 of file lstfastio.cpp.
References EMAN::Util::check_file_by_magic(), ENTERFUNC, EXITFUNC, and MAGIC.
Referenced by EMAN::EMUtil::fast_get_image_type(), and EMAN::EMUtil::get_image_type().
| EMAN::LstFastIO::DEFINE_IMAGEIO_FUNC |
Definition at line 60 of file lstfastio.h.
|
private |
Definition at line 72 of file lstfastio.h.
Referenced by calc_ref_image_index().
|
private |
Definition at line 74 of file lstfastio.h.
Referenced by calc_ref_image_index(), LstFastIO(), and ~LstFastIO().
|
private |
Definition at line 69 of file lstfastio.h.
Referenced by LstFastIO().
|
private |
Definition at line 77 of file lstfastio.h.
Referenced by calc_ref_image_index(), and LstFastIO().
|
private |
Definition at line 78 of file lstfastio.h.
Referenced by calc_ref_image_index(), and LstFastIO().
|
private |
Definition at line 71 of file lstfastio.h.
Referenced by calc_ref_image_index().
|
staticprivate |
Definition at line 81 of file lstfastio.h.
Referenced by is_valid().
|
private |
Definition at line 70 of file lstfastio.h.
Referenced by get_nimg(), and LstFastIO().
|
private |
Definition at line 75 of file lstfastio.h.
Referenced by calc_ref_image_index(), LstFastIO(), and ~LstFastIO().