EMAN2
serio.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__serio_h__
33#define eman__serio_h__ 1
34
35#include "imageio.h"
36
37#ifdef _WIN32
38typedef unsigned long long uint64_t;
39#else
40#include "stdint.h"
41#endif
42
43namespace EMAN
44{
55 class SerIO : public ImageIO
56 {
57 public:
58 explicit SerIO(const string & fname, IOMode rw_mode = READ_ONLY);
59 ~SerIO();
60
62 static bool is_valid(const void *first_block);
63 int get_nimg();
64
65 private:
67 oneD = 0x4120,
68 twoD = 0x4122
69 };
70
72 timeOnly = 0x4152,
73 posTime = 0x4122
74 };
75
88 };
89
90 //This header struct has an alignment issue. It's size is 32 instead of 30.
91 //So we need read the item one by one.
92 struct SerHeader {
93 short ByteOrder;
94 short SeriesID;
100 int OffsetArrayOffset; // could also be 64 bits in new version, we don't actually use this header
102 };
103
105
107
110
111 int nimg; //total image number in this file
112 int nx;
113 int ny;
114 int nz;
115 int datatypeid; //1D or 2D image
116 int datamode; //data value mode (int, float, etc.)
117
119 void read_dim_arr(Dict & dict, int idx);
120
122 void read_data_element(Dict & dict);
123
125 void read_data_tag(Dict & dict);
126 };
127
128}
129
130#endif //eman__serio_h__
Dict is a dictionary to store <string, EMObject> pair.
Definition: emobject.h:385
ImageIO classes are designed for reading/writing various electron micrography image formats,...
Definition: imageio.h:127
IOMode rw_mode
Definition: imageio.h:353
SER (Series File Format) is a file format created by Dr.
Definition: serio.h:56
SerTagType
Definition: serio.h:71
@ posTime
Definition: serio.h:73
@ timeOnly
Definition: serio.h:72
bool is_new_file
Definition: serio.h:104
void read_data_element(Dict &dict)
helper function to read header attributes in data element
Definition: serio.cpp:441
static bool is_valid(const void *first_block)
Definition: serio.cpp:94
SerImgMode
Definition: serio.h:66
@ twoD
Definition: serio.h:68
@ oneD
Definition: serio.h:67
void read_data_tag(Dict &dict)
helper function to read header attributes in data tag
Definition: serio.cpp:523
SerDataMode
Definition: serio.h:76
@ SER_COMPLEX16
Definition: serio.h:86
@ SER_USHORT
Definition: serio.h:78
@ SER_INT
Definition: serio.h:82
@ SER_CHAR
Definition: serio.h:80
@ SER_UCHAR
Definition: serio.h:77
@ UNKNOWN
Definition: serio.h:87
@ SER_UINT
Definition: serio.h:79
@ SER_DOUBLE
Definition: serio.h:84
@ SER_FLOAT
Definition: serio.h:83
@ SER_SHORT
Definition: serio.h:81
@ SER_COMPLEX8
Definition: serio.h:85
int get_nimg()
Return the number of images in this image file.
Definition: serio.cpp:368
DEFINE_IMAGEIO_FUNC
Definition: serio.h:61
int datamode
Definition: serio.h:116
int datatypeid
Definition: serio.h:115
void read_dim_arr(Dict &dict, int idx)
helper function to read attributes in dimension array
Definition: serio.cpp:380
int nx
Definition: serio.h:112
uint64_t * data_offset_array
Definition: serio.h:108
int ny
Definition: serio.h:113
int nimg
Definition: serio.h:111
int nz
Definition: serio.h:114
uint64_t * tag_offset_array
Definition: serio.h:109
SerIO(const string &fname, IOMode rw_mode=READ_ONLY)
Definition: serio.cpp:45
SerHeader serh
Definition: serio.h:106
E2Exception class.
Definition: aligner.h:40