#include <dm3io.h>
Inheritance diagram for EMAN::DM3IO:
Public Member Functions | |
DM3IO (const string &filename, IOMode rw_mode=READ_ONLY) | |
~DM3IO () | |
Static Public Member Functions | |
static bool | is_valid (const void *first_block) |
Public Attributes | |
DEFINE_IMAGEIO_FUNC | |
Private Types | |
NUM_ID_INT = 3 | |
enum | { NUM_ID_INT = 3 } |
Private Attributes | |
string | filename |
IOMode | rw_mode |
FILE * | dm3file |
bool | is_big_endian |
bool | initialized |
Gatan::TagTable * | tagtable |
Everything in the image is a <key, value> pair, where key may be a container-type key which contains more key/value pairs. To read its header information, the whole file has to be parsed. During parsing, we check the keys that we are interested in and get their values.
The real binary data itself is also in this key/value hierarchy.
1 Gatan DM3 file contains 1 2D image.
Definition at line 246 of file dm3io.h.
anonymous enum [private] |
DM3IO::DM3IO | ( | const string & | filename, | |
IOMode | rw_mode = READ_ONLY | |||
) | [explicit] |
Definition at line 637 of file dm3io.cpp.
References is_big_endian, EMAN::ByteOrder::is_host_big_endian(), and tagtable.
00638 : filename(dm3_filename), rw_mode(rw), dm3file(0), initialized(false) 00639 { 00640 is_big_endian = ByteOrder::is_host_big_endian(); 00641 tagtable = new TagTable(); 00642 }
DM3IO::~DM3IO | ( | ) |
bool DM3IO::is_valid | ( | const void * | first_block | ) | [static] |
Definition at line 699 of file dm3io.cpp.
References EMAN::ByteOrder::become_big_endian(), data, and ENTERFUNC.
Referenced by EMAN::EMUtil::fast_get_image_type(), and EMAN::EMUtil::get_image_type().
00700 { 00701 ENTERFUNC; 00702 00703 if (!first_block) { 00704 return false; 00705 } 00706 00707 const int *data = static_cast < const int *>(first_block); 00708 00709 int img_ver = data[0]; 00710 int img_size = data[1]; 00711 int byte_order = data[2]; 00712 00713 ByteOrder::become_big_endian(&img_ver); 00714 00715 if (img_ver != 3) { 00716 return false; 00717 } 00718 00719 ByteOrder::become_big_endian(&img_size); 00720 ByteOrder::become_big_endian(&byte_order); 00721 00722 if (byte_order != 0 && byte_order != 1) { 00723 return false; 00724 } 00725 00726 return true; 00727 }
FILE* EMAN::DM3IO::dm3file [private] |
string EMAN::DM3IO::filename [private] |
bool EMAN::DM3IO::initialized [private] |
bool EMAN::DM3IO::is_big_endian [private] |
IOMode EMAN::DM3IO::rw_mode [private] |
Gatan::TagTable* EMAN::DM3IO::tagtable [private] |