#include <omapio.h>
Inheritance diagram for EMAN::OmapIO:
Public Member Functions | |
OmapIO (const string &omapname, IOMode rw_mode=READ_ONLY) | |
~OmapIO () | |
Static Public Member Functions | |
bool | is_valid (const void *first_block, off_t file_size=0) |
Public Attributes | |
DEFINE_IMAGEIO_FUNC | |
Private Attributes | |
string | filename |
IOMode | rw_mode |
FILE * | omapfile |
OmapHeader | omaph |
bool | is_big_endian |
bool | initialized |
bool | is_new_file |
The first is a header which contains all the information required to intercept the rest of the file. The subsequent bricks contain blocks of electron density. Each density sample is one byte in size. The order of the samples within a brick is "x fast, y medium, and z slow". http://www.uoxray.uoregon.edu/tnt/manual/node104.html
Definition at line 54 of file omapio.h.
|
Definition at line 41 of file omapio.cpp. References is_big_endian, EMAN::ByteOrder::is_host_big_endian(), and omaph. 00041 : 00042 filename(omapname), rw_mode(rw), omapfile(0), 00043 is_big_endian(false), initialized(false), is_new_file(false) 00044 { 00045 memset(&omaph, 0, sizeof(OmapHeader)); 00046 is_big_endian = ByteOrder::is_host_big_endian(); 00047 }
|
|
Definition at line 49 of file omapio.cpp. References omapfile. 00050 { 00051 if (omapfile) { 00052 fclose(omapfile); 00053 omapfile = 0; 00054 } 00055 }
|
|
Definition at line 240 of file omapio.cpp. References data, EMAN::ByteOrder::is_host_big_endian(), nx, ny, and EMAN::ByteOrder::swap_bytes(). Referenced by EMAN::EMUtil::fast_get_image_type(), and EMAN::EMUtil::get_image_type(). 00241 { 00242 ENTERFUNC; 00243 00244 if (!first_block) { 00245 return false; 00246 } 00247 00248 const short *data = static_cast < const short *>(first_block); 00249 short xstart = data[0]; 00250 short ystart = data[1]; 00251 short zstart = data[2]; 00252 short nx = data[3]; 00253 short ny = data[4]; 00254 short nz = data[5]; 00255 short const_value = data[18]; 00256 00257 if(!ByteOrder::is_host_big_endian()) { 00258 ByteOrder::swap_bytes(&xstart); 00259 ByteOrder::swap_bytes(&ystart); 00260 ByteOrder::swap_bytes(&zstart); 00261 ByteOrder::swap_bytes(&nx); 00262 ByteOrder::swap_bytes(&ny); 00263 ByteOrder::swap_bytes(&nz); 00264 ByteOrder::swap_bytes(&const_value); 00265 } 00266 00267 if(const_value != 100) return false; 00268 if(nx<=0 || ny<=0 || nz<=0 || nx>10000 || ny>10000 || nz>10000) return false; 00269 00270 EXITFUNC; 00271 return true; 00272 }
|
|
|
|
|
|
|
|
Definition at line 101 of file omapio.h. Referenced by OmapIO(). |
|
|
|
Definition at line 98 of file omapio.h. Referenced by ~OmapIO(). |
|
Definition at line 99 of file omapio.h. Referenced by OmapIO(). |
|
|