#include <gatan2io.h>
Inheritance diagram for EMAN::Gatan2IO:
Public Member Functions | |
Gatan2IO (const string &filename, IOMode rw_mode=READ_ONLY) | |
~Gatan2IO () | |
Static Public Member Functions | |
bool | is_valid (const void *first_block) |
Public Attributes | |
DEFINE_IMAGEIO_FUNC | |
Private Types | |
enum | DataType { GATAN2_SHORT = 1, GATAN2_FLOAT = 2, GATAN2_COMPLEX = 3, GATAN2_PACKED_COMPLEX = 5, GATAN2_CHAR = 6, GATAN2_INT = 7, GATAN2_INVALID } |
Private Member Functions | |
int | to_em_datatype (int gatan_type) |
Private Attributes | |
string | filename |
IOMode | rw_mode |
FILE * | gatan2_file |
Gatan2Header | gatanh |
bool | is_big_endian |
bool | initialized |
header is defined in Gatan2Header. data is nx by ny. A Gatan2 file contains 1 2D image.
Definition at line 49 of file gatan2io.h.
|
Definition at line 58 of file gatan2io.h. 00059 { 00060 GATAN2_SHORT = 1, 00061 GATAN2_FLOAT = 2, 00062 GATAN2_COMPLEX = 3, 00063 GATAN2_PACKED_COMPLEX = 5, 00064 GATAN2_CHAR = 6, 00065 GATAN2_INT = 7, 00066 GATAN2_INVALID 00067 };
|
|
Definition at line 43 of file gatan2io.cpp. References gatanh, is_big_endian, and EMAN::ByteOrder::is_host_big_endian(). 00044 : filename(file), rw_mode(rw), gatan2_file(0), initialized(false) 00045 { 00046 is_big_endian = ByteOrder::is_host_big_endian(); 00047 memset(&gatanh, 0, sizeof(Gatan2Header)); 00048 }
|
|
Definition at line 50 of file gatan2io.cpp. References gatan2_file. 00051 { 00052 if (gatan2_file) { 00053 fclose(gatan2_file); 00054 gatan2_file = 0; 00055 } 00056 }
|
|
Definition at line 86 of file gatan2io.cpp. References data, 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(). 00087 { 00088 ENTERFUNC; 00089 bool result = false; 00090 00091 if (!first_block) { 00092 result = false; 00093 } 00094 else { 00095 const short *data = static_cast < const short *>(first_block); 00096 short len = data[5]; 00097 short type = data[6]; 00098 00099 bool data_big_endian = ByteOrder::is_data_big_endian(&len); 00100 00101 if (data_big_endian != ByteOrder::is_host_big_endian()) { 00102 ByteOrder::swap_bytes(&len); 00103 ByteOrder::swap_bytes(&type); 00104 } 00105 00106 int double_size = sizeof(double); 00107 if (len > 0 && len <= double_size && type > 0 && type <= GATAN2_INVALID) { 00108 result = true; 00109 } 00110 } 00111 EXITFUNC; 00112 return result; 00113 }
|
|
Definition at line 243 of file gatan2io.cpp. References GATAN2_CHAR, GATAN2_FLOAT, GATAN2_INT, and GATAN2_SHORT. 00244 { 00245 switch (gatan_type) { 00246 case GATAN2_SHORT: 00247 return EMUtil::EM_SHORT; 00248 00249 case GATAN2_FLOAT: 00250 return EMUtil::EM_FLOAT; 00251 00252 case GATAN2_CHAR: 00253 return EMUtil::EM_CHAR; 00254 00255 case GATAN2_INT: 00256 return EMUtil::EM_INT; 00257 } 00258 00259 return EMUtil::EM_UNKNOWN; 00260 }
|
|
Definition at line 55 of file gatan2io.h. |
|
Definition at line 83 of file gatan2io.h. |
|
Definition at line 85 of file gatan2io.h. Referenced by ~Gatan2IO(). |
|
Definition at line 86 of file gatan2io.h. Referenced by Gatan2IO(). |
|
Definition at line 89 of file gatan2io.h. |
|
Definition at line 88 of file gatan2io.h. Referenced by Gatan2IO(). |
|
Definition at line 84 of file gatan2io.h. |