EMAN2
emio.h
Go to the documentation of this file.
1/*
2 * Author: Steven Ludtke, 04/10/2003 (sludtke@bcm.edu)
3 * Copyright (c) 2000-2006 Baylor College of Medicine
4 *
5 * This software is issued under a joint BSD/GNU license. You may use the
6 * source code in this file under either license. However, note that the
7 * complete EMAN2 and SPARX software packages have some GPL dependencies,
8 * so you are responsible for compliance with the licenses of these packages
9 * if you opt to use BSD licensing. The warranty disclaimer below holds
10 * in either instance.
11 *
12 * This complete copyright notice must be included in any revised version of the
13 * source code. Additional authorship citations may be added, but existing
14 * author citations must be preserved.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 *
30 * */
31
32#ifndef eman__emio_h__
33#define eman__emio_h__ 1
34
35#include "imageio.h"
36
37namespace EMAN
38{
44 class EmIO : public ImageIO
45 {
46 public:
47 explicit EmIO(const string & fname, IOMode rw_mode = READ_ONLY);
48 ~EmIO();
49
51 static bool is_valid(const void *first_block, off_t file_size = 0);
52 static size_t get_mode_size(char data_type);
53 static int get_machine_type();
54 static int to_em_datatype(char t);
55
56 private:
57 struct EMHeader
58 {
59 char machine; // 0=OS-8, 1=VAX; 2=Convex; 3=SGI; 5=Mac; 6=PC
60 char is_new_ver; // OS-9 only
62 char data_type; // 1=byte, 2=short; 4=int; 5=float; 8=complex; 9=double
63 int nx;
64 int ny;
65 int nz;
66 char comment[80];
67 int parameters[40];
68 char username[20];
69 char date[8];
70 char userdata[228];
71 };
72
74 {
82 };
83
85 {
86 EM_OS8 = 0,
87 EM_VAX = 1,
89 EM_SGI = 3,
90 EM_MAC = 5,
91 EM_PC = 6,
93 };
94
95 private:
97
98 size_t mode_size;
102 };
103
104}
105
106
107#endif //eman__emio_h__
EmIO defines I/O operations on EM image format.
Definition: emio.h:45
DataType
Definition: emio.h:74
@ EM_EM_UNKNOWN
Definition: emio.h:81
@ EM_EM_CHAR
Definition: emio.h:75
@ EM_EM_FLOAT
Definition: emio.h:78
@ EM_EM_COMPLEX
Definition: emio.h:79
@ EM_EM_SHORT
Definition: emio.h:76
@ EM_EM_DOUBLE
Definition: emio.h:80
@ EM_EM_INT
Definition: emio.h:77
static size_t get_mode_size(char data_type)
Definition: emio.cpp:349
static int get_machine_type()
Definition: emio.cpp:324
MachineType
Definition: emio.h:85
@ EM_SGI
Definition: emio.h:89
@ EM_UNKNOWN_MACHINE
Definition: emio.h:92
@ EM_VAX
Definition: emio.h:87
@ EM_PC
Definition: emio.h:91
@ EM_OS8
Definition: emio.h:86
@ EM_MAC
Definition: emio.h:90
@ EM_CONVEX
Definition: emio.h:88
static bool is_valid(const void *first_block, off_t file_size=0)
Definition: emio.cpp:95
static int to_em_datatype(char t)
Definition: emio.cpp:302
EMHeader emh
Definition: emio.h:96
EmIO(const string &fname, IOMode rw_mode=READ_ONLY)
Definition: emio.cpp:38
DEFINE_IMAGEIO_FUNC
Definition: emio.h:50
size_t mode_size
Definition: emio.h:98
DataType mode
Definition: emio.h:99
bool is_new_file
Definition: emio.h:101
bool is_big_endian
Definition: emio.h:100
~EmIO()
Definition: emio.cpp:48
ImageIO classes are designed for reading/writing various electron micrography image formats,...
Definition: imageio.h:127
IOMode rw_mode
Definition: imageio.h:353
E2Exception class.
Definition: aligner.h:40
int parameters[40]
Definition: emio.h:67
char userdata[228]
Definition: emio.h:70
char username[20]
Definition: emio.h:68
char comment[80]
Definition: emio.h:66
char date[8]
Definition: emio.h:69