Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

EMAN::DM4IO Class Reference

Gatan DM$ was introduced with the GMS 2.0 release. More...

#include <dm4io.h>

Inheritance diagram for EMAN::DM4IO:

Inheritance graph
[legend]
Collaboration diagram for EMAN::DM4IO:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 DM4IO (const string &filename, IOMode rw_mode=READ_ONLY)
 ~DM4IO ()

Static Public Member Functions

bool is_valid (const void *first_block)

Public Attributes

 DEFINE_IMAGEIO_FUNC

Private Types

enum  { NUM_ID_INT = 4 }

Private Attributes

string filename
IOMode rw_mode
FILE * dm4file
bool is_big_endian
bool initialized
GatanDM4::TagTabletagtable

Detailed Description

Gatan DM$ was introduced with the GMS 2.0 release.

Each file starts with a TagGroupWithVersion record which saves the root TagGroup with some additional information.

Gatan DM4 file is a hierarchical binary image format. 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 DM4 file contains 1 2D image.

All data is saved by default with big endian encoding.

Definition at line 250 of file dm4io.h.


Member Enumeration Documentation

anonymous enum [private]
 

Enumeration values:
NUM_ID_INT 

Definition at line 260 of file dm4io.h.

00260 { NUM_ID_INT = 4 };     //actually its int+long+int=16 bytes


Constructor & Destructor Documentation

DM4IO::DM4IO const string &  filename,
IOMode  rw_mode = READ_ONLY
[explicit]
 

Definition at line 697 of file dm4io.cpp.

References is_big_endian, and tagtable.

00698         :       filename(dm4_filename), rw_mode(rw), dm4file(0), initialized(false)
00699 {
00700         is_big_endian = ByteOrder::is_host_big_endian();
00701         tagtable = new TagTable();
00702 }

DM4IO::~DM4IO  ) 
 

Definition at line 704 of file dm4io.cpp.

References dm4file, and tagtable.

00705 {
00706         if (dm4file) {
00707                 fclose(dm4file);
00708                 dm4file = 0;
00709         }
00710         if (tagtable) {
00711                 delete tagtable;
00712                 tagtable = 0;
00713         }
00714 }


Member Function Documentation

bool DM4IO::is_valid const void *  first_block  )  [static]
 

Definition at line 766 of file dm4io.cpp.

References data.

Referenced by EMAN::EMUtil::fast_get_image_type(), and EMAN::EMUtil::get_image_type().

00767 {
00768         ENTERFUNC;
00769 
00770         if (!first_block) {
00771                 return false;
00772         }
00773 
00774         const int *data = static_cast < const int *>(first_block);
00775 
00776         int img_ver = data[0];
00777         int byte_order = data[3];
00778         if (ByteOrder::is_data_big_endian(&img_ver) != ByteOrder::is_host_big_endian()) {
00779                 ByteOrder::swap_bytes(&img_ver);
00780                 ByteOrder::swap_bytes(&byte_order);
00781         }
00782 
00783         if (img_ver != 4) {
00784                 return false;
00785         }
00786 
00787         if (byte_order != 0 && byte_order != 1) {
00788                 return false;
00789         }
00790 
00791         return true;
00792 }


Member Data Documentation

EMAN::DM4IO::DEFINE_IMAGEIO_FUNC
 

Definition at line 256 of file dm4io.h.

FILE* EMAN::DM4IO::dm4file [private]
 

Definition at line 264 of file dm4io.h.

Referenced by ~DM4IO().

string EMAN::DM4IO::filename [private]
 

Definition at line 262 of file dm4io.h.

bool EMAN::DM4IO::initialized [private]
 

Definition at line 266 of file dm4io.h.

bool EMAN::DM4IO::is_big_endian [private]
 

Definition at line 265 of file dm4io.h.

Referenced by DM4IO().

IOMode EMAN::DM4IO::rw_mode [private]
 

Definition at line 263 of file dm4io.h.

GatanDM4::TagTable* EMAN::DM4IO::tagtable [private]
 

Definition at line 267 of file dm4io.h.

Referenced by DM4IO(), and ~DM4IO().


The documentation for this class was generated from the following files:
Generated on Tue Jun 11 13:48:00 2013 for EMAN2 by  doxygen 1.3.9.1