Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes
EMAN::OmapIO Class Reference

DSN6 MAP is composed of a series of records which are all 512 bytes long. More...

#include <omapio.h>

Inheritance diagram for EMAN::OmapIO:
Inheritance graph
Collaboration diagram for EMAN::OmapIO:
Collaboration graph

List of all members.


struct  OmapHeader
 The data in the header is composed of 256 short integers. More...

Public Member Functions

 OmapIO (const string &omapname, IOMode rw_mode=READ_ONLY)
 ~OmapIO ()

Static Public Member Functions

static bool is_valid (const void *first_block, off_t file_size=0)

Public Attributes


Private Attributes

string filename
IOMode rw_mode
FILE * omapfile
OmapHeader omaph
bool is_big_endian
bool initialized
bool is_new_file

Detailed Description

DSN6 MAP is composed of a series of records which are all 512 bytes long.

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.

Constructor & Destructor Documentation

OmapIO::OmapIO ( const string &  omapname,
IOMode  rw_mode = READ_ONLY 
) [explicit]

Definition at line 41 of file omapio.cpp.

References is_big_endian, EMAN::ByteOrder::is_host_big_endian(), and omaph.

                filename(omapname), rw_mode(rw), omapfile(0),
                is_big_endian(false), initialized(false), is_new_file(false)
        memset(&omaph, 0, sizeof(OmapHeader));
        is_big_endian = ByteOrder::is_host_big_endian();
OmapIO::~OmapIO ( )

Definition at line 49 of file omapio.cpp.

References omapfile.

        if (omapfile) {
                omapfile = 0;

Member Function Documentation

bool OmapIO::is_valid ( const void *  first_block,
off_t  file_size = 0 
) [static]

Definition at line 240 of file omapio.cpp.

References data, ENTERFUNC, EXITFUNC, 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().


        if (!first_block) {
                return false;

        const short *data = static_cast < const short *>(first_block);
        short xstart = data[0];
        short ystart = data[1];
        short zstart = data[2];
        short nx = data[3];
        short ny = data[4];
        short nz = data[5];
        short const_value = data[18];

        if(!ByteOrder::is_host_big_endian()) {

        if(const_value != 100) return false;
        if(nx<=0 || ny<=0 || nz<=0 || nx>10000 || ny>10000 || nz>10000) return false;

        return true;

Member Data Documentation

Definition at line 60 of file omapio.h.

string EMAN::OmapIO::filename [private]

Definition at line 96 of file omapio.h.

bool EMAN::OmapIO::initialized [private]

Definition at line 102 of file omapio.h.

Definition at line 101 of file omapio.h.

Referenced by OmapIO().

bool EMAN::OmapIO::is_new_file [private]

Definition at line 103 of file omapio.h.

FILE* EMAN::OmapIO::omapfile [private]

Definition at line 98 of file omapio.h.

Referenced by ~OmapIO().

Definition at line 99 of file omapio.h.

Referenced by OmapIO().

Definition at line 97 of file omapio.h.

The documentation for this class was generated from the following files: