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

EMAN::DM3IO Class Reference

Gatan DM3 file is a hierarchical binary image format. More...

#include <dm3io.h>

Inheritance diagram for EMAN::DM3IO:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

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

Static Public Member Functions

bool is_valid (const void *first_block)

Public Attributes

 DEFINE_IMAGEIO_FUNC

Private Types

enum  { NUM_ID_INT = 3 }

Private Attributes

string filename
IOMode rw_mode
FILE * dm3file
bool is_big_endian
bool initialized
Gatan::TagTabletagtable

Detailed Description

Gatan DM3 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 DM3 file contains 1 2D image.

Definition at line 246 of file dm3io.h.


Member Enumeration Documentation

anonymous enum [private]
 

Enumeration values:
NUM_ID_INT 

Definition at line 256 of file dm3io.h.

00257                 { NUM_ID_INT = 3 };


Constructor & Destructor Documentation

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

Definition at line 638 of file dm3io.cpp.

References is_big_endian, and tagtable.

00639         :       filename(dm3_filename), rw_mode(rw), dm3file(0), initialized(false)
00640 {
00641         is_big_endian = ByteOrder::is_host_big_endian();
00642         tagtable = new TagTable();
00643 }

DM3IO::~DM3IO  ) 
 

Definition at line 645 of file dm3io.cpp.

References dm3file, and tagtable.

00646 {
00647         if (dm3file) {
00648                 fclose(dm3file);
00649                 dm3file = 0;
00650         }
00651         if (tagtable) {
00652                 delete tagtable;
00653                 tagtable = 0;
00654         }
00655 }


Member Function Documentation

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

Definition at line 700 of file dm3io.cpp.

References data.

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

00701 {
00702         ENTERFUNC;
00703 
00704         if (!first_block) {
00705                 return false;
00706         }
00707 
00708         const int *data = static_cast < const int *>(first_block);
00709 
00710         int img_ver = data[0];
00711         int img_size = data[1];
00712         int byte_order = data[2];
00713 
00714         ByteOrder::become_big_endian(&img_ver);
00715 
00716         if (img_ver != 3) {
00717                 return false;
00718         }
00719 
00720         ByteOrder::become_big_endian(&img_size);
00721         ByteOrder::become_big_endian(&byte_order);
00722 
00723         if (byte_order != 0 && byte_order != 1) {
00724                 return false;
00725         }
00726 
00727         return true;
00728 }


Member Data Documentation

EMAN::DM3IO::DEFINE_IMAGEIO_FUNC
 

Definition at line 252 of file dm3io.h.

FILE* EMAN::DM3IO::dm3file [private]
 

Definition at line 262 of file dm3io.h.

Referenced by ~DM3IO().

string EMAN::DM3IO::filename [private]
 

Definition at line 260 of file dm3io.h.

bool EMAN::DM3IO::initialized [private]
 

Definition at line 264 of file dm3io.h.

bool EMAN::DM3IO::is_big_endian [private]
 

Definition at line 263 of file dm3io.h.

Referenced by DM3IO().

IOMode EMAN::DM3IO::rw_mode [private]
 

Definition at line 261 of file dm3io.h.

Gatan::TagTable* EMAN::DM3IO::tagtable [private]
 

Definition at line 265 of file dm3io.h.

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


The documentation for this class was generated from the following files:
Generated on Thu Nov 17 12:45:29 2011 for EMAN2 by  doxygen 1.3.9.1