#include <emimio.h>
Inheritance diagram for EMAN::EmimIO:


Public Member Functions | |
| EmimIO (const string &filename, IOMode rw_mode=READ_ONLY) | |
| ~EmimIO () | |
| bool | is_single_image_format () const |
| Is this image format only storing 1 image or not. | |
| int | get_nimg () |
| Return the number of images in this image file. | |
Static Public Member Functions | |
| bool | is_valid (const void *first_block) |
Public Attributes | |
| DEFINE_IMAGEIO_FUNC | |
Private Types | |
| enum | { EMIM_COMPLEX = 1, PARM_NONE = 0, PARM_NORM = 1, NUM_INT_IN_FILE_HEADER = 16 } |
Private Attributes | |
| string | filename |
| IOMode | rw_mode |
| EmimFileHeader | efh |
| FILE * | emim_file |
| bool | is_big_endian |
| bool | initialized |
Static Private Attributes | |
| const char * | MAGIC = "EMIM" |
EmimFileHeader defines the number of images 'n' in the file. All following images have the same dimensions:nx x ny x nz.
Definition at line 48 of file emimio.h.
|
|
Definition at line 66 of file emimio.h. 00067 {
00068 EMIM_COMPLEX = 1,
00069 PARM_NONE = 0,
00070 PARM_NORM = 1,
00071 NUM_INT_IN_FILE_HEADER = 16
00072 };
|
|
||||||||||||
|
Definition at line 44 of file emimio.cpp. References efh, is_big_endian, and EMAN::ByteOrder::is_host_big_endian(). 00045 : filename(file), rw_mode(rw), emim_file(0), initialized(false) 00046 { 00047 is_big_endian = ByteOrder::is_host_big_endian(); 00048 memset(&efh, 0, sizeof(EmimFileHeader)); 00049 }
|
|
|
Definition at line 51 of file emimio.cpp. References emim_file. 00052 {
00053 if (emim_file) {
00054 fclose(emim_file);
00055 emim_file = 0;
00056 }
00057 }
|
|
|
Return the number of images in this image file.
Reimplemented from EMAN::ImageIO. Definition at line 212 of file emimio.cpp. References EMAN::EmimIO::EmimFileHeader::count, efh, and EMAN::ImageIO::init().
|
|
|
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 58 of file emimio.h. 00059 {
00060 return false;
00061 }
|
|
|
Definition at line 86 of file emimio.cpp. References data, EMAN::ByteOrder::is_data_big_endian(), EMAN::ByteOrder::is_host_big_endian(), MAGIC, and EMAN::ByteOrder::swap_bytes(). 00087 {
00088 ENTERFUNC;
00089
00090 if (!first_block) {
00091 return false;
00092 }
00093
00094 const char *data = static_cast < const char *>(first_block);
00095 const int *idata = static_cast < const int *>(first_block);
00096 int count = idata[2];
00097
00098 if (strncmp(data, MAGIC, sizeof(MAGIC)) == 0) {
00099 bool data_big_endian = ByteOrder::is_data_big_endian(&count);
00100
00101 if (data_big_endian != ByteOrder::is_host_big_endian()) {
00102 ByteOrder::swap_bytes(&count);
00103 }
00104
00105 if (count >= 0 && count <= 1 << 20) {
00106 return true;
00107 }
00108 }
00109 EXITFUNC;
00110 return false;
00111 }
|
|
|
|
|
|
Definition at line 108 of file emimio.h. Referenced by EmimIO(), and get_nimg(). |
|
|
Definition at line 109 of file emimio.h. Referenced by ~EmimIO(). |
|
|
|
|
|
|
|
|
Definition at line 110 of file emimio.h. Referenced by EmimIO(). |
|
|
Definition at line 42 of file emimio.cpp. Referenced by is_valid(). |
|
|
|
1.3.9.1