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

EMAN::IcosIO Class Reference

ICOS file = header + data. More...

#include <icosio.h>

Inheritance diagram for EMAN::IcosIO:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

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

Static Public Member Functions

bool is_valid (const void *first_block)

Public Attributes

 DEFINE_IMAGEIO_FUNC

Private Types

enum  { STAMP = 72, STAMP1 = 72, STAMP2 = 20, STAMP3 = 20 }

Private Attributes

string filename
IOMode rw_mode
IcosHeader icosh
FILE * icos_file
bool is_big_endian
bool initialized
bool is_new_file

Detailed Description

ICOS file = header + data.

1. header, defined in IcosHeader. 2. data: ny*nz of rows. Each row = n1 + row-data + n2 where n1: an integer. n1 = nx*sizeof(float). n2: an integer. n2 = n1. row-data: nx numbers of float points.

An Icos file stores 1 2D or 3D image.

Definition at line 54 of file icosio.h.


Member Enumeration Documentation

anonymous enum [private]
 

Enumeration values:
STAMP 
STAMP1 
STAMP2 
STAMP3 

Definition at line 64 of file icosio.h.

00065                 { STAMP = 72, STAMP1 = 72, STAMP2 = 20, STAMP3 = 20 };


Constructor & Destructor Documentation

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

Definition at line 44 of file icosio.cpp.

References icosh, is_big_endian, EMAN::ByteOrder::is_host_big_endian(), and is_new_file.

00045 :       filename(file), rw_mode(rw), icos_file(0), initialized(false)
00046 {
00047         is_big_endian = ByteOrder::is_host_big_endian();
00048         is_new_file = false;
00049         memset(&icosh, 0, sizeof(IcosHeader));
00050 }

IcosIO::~IcosIO  ) 
 

Definition at line 52 of file icosio.cpp.

References icos_file.

00053 {
00054         if (icos_file) {
00055                 fclose(icos_file);
00056                 icos_file = 0;
00057         }
00058 }


Member Function Documentation

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

Definition at line 84 of file icosio.cpp.

References data, EMAN::ByteOrder::is_data_big_endian(), EMAN::ByteOrder::is_host_big_endian(), STAMP, STAMP1, STAMP2, and EMAN::ByteOrder::swap_bytes().

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

00085 {
00086         ENTERFUNC;
00087         bool result = false;
00088         if (!first_block) {
00089                 result = false;
00090         }
00091         else {
00092                 const int *data = static_cast < const int *>(first_block);
00093                 int stamp = data[0];
00094                 int stamp1 = data[19];
00095                 int stamp2 = data[20];
00096                 int stamp3 = data[26];
00097 
00098                 bool data_big_endian = ByteOrder::is_data_big_endian(&stamp);
00099 
00100                 if (data_big_endian != ByteOrder::is_host_big_endian()) {
00101                         ByteOrder::swap_bytes(&stamp);
00102                         ByteOrder::swap_bytes(&stamp1);
00103                         ByteOrder::swap_bytes(&stamp2);
00104                         ByteOrder::swap_bytes(&stamp3);
00105                 }
00106 
00107                 if (stamp == STAMP && stamp1 == STAMP1 && stamp2 == STAMP2 && stamp3 == STAMP3) {
00108                         result = true;
00109                 }
00110         }
00111         EXITFUNC;
00112         return result;
00113 }


Member Data Documentation

EMAN::IcosIO::DEFINE_IMAGEIO_FUNC
 

Definition at line 60 of file icosio.h.

string EMAN::IcosIO::filename [private]
 

Definition at line 82 of file icosio.h.

FILE* EMAN::IcosIO::icos_file [private]
 

Definition at line 85 of file icosio.h.

Referenced by ~IcosIO().

IcosHeader EMAN::IcosIO::icosh [private]
 

Definition at line 84 of file icosio.h.

Referenced by IcosIO().

bool EMAN::IcosIO::initialized [private]
 

Definition at line 87 of file icosio.h.

bool EMAN::IcosIO::is_big_endian [private]
 

Definition at line 86 of file icosio.h.

Referenced by IcosIO().

bool EMAN::IcosIO::is_new_file [private]
 

Definition at line 88 of file icosio.h.

Referenced by IcosIO().

IOMode EMAN::IcosIO::rw_mode [private]
 

Definition at line 83 of file icosio.h.


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