Xmipp  v3.23.11-Nereus
rwSPIDER.h
Go to the documentation of this file.
1 /*
2  Based on rwSPIDER.h
3  Header file for reading and writing SPIDER files
4  Format: 3D image file format for the SPIDER package
5  Author: Bernard Heymann
6  Created: 19990410 Modified: 20010928
7 */
8 
9 #ifndef CORE_RWSPIDER_H
10 #define CORE_RWSPIDER_H
11 
12 #define SPIDERSIZE 1024 // Minimum size of the SPIDER header (variable)
13 
19 struct SPIDERhead
20 { // file header for SPIDER data
21  float nslice; // 0 slices in volume (image = 1)
22  float nrow; // 1 rows per slice
23  float irec; // 2 # records in file (unused)
24  float nhistrec; // 3 (obsolete)
25  float iform; // 4 file type specifier
26  float imami; // 5 max/min flag (=1 if calculated)
27  float fmax; // 6 maximum
28  float fmin; // 7 minimum
29  float av; // 8 average
30  float sig; // 9 standard deviation (=-1 if not calculated)
31  float ihist; // 10 (obsolete)
32  float nsam; // 11 pixels per row
33  float labrec; // 12 # records in header
34  float iangle; // 13 flag: tilt angles filled
35  float phi; // 14 tilt angles
36  float theta; // 15
37  float gamma; // 16 (=psi)
38  float xoff; // 17 translation
39  float yoff; // 18
40  float zoff; // 19
41  float scale; // 20 scaling
42  float labbyt; // 21 # bytes in header
43  float lenbyt; // 22 record length in bytes (row length)
44  float istack; // 23 indicates stack of images
45  float inuse; // 24 indicates this image in stack is used (not used)
46  float maxim; // 25 max image in stack used
47  float imgnum; // 26 number of current image
48  float unused[2]; // 27-28 (unused)
49  float kangle; // 29 flag: additional angles set
50  float phi1; // 30 additional angles
51  float theta1; // 31
52  float psi1; // 32
53  float phi2; // 33
54  float theta2; // 34
55  float psi2; // 35
56 
57  double fGeo_matrix[3][3]; // x9 = 72 bytes: Geometric info
58  float fAngle1; // angle info
59 
60  float fr1;
61  float fr2; // lift up cosine mask parameters
62 
64  float RTflag; // 1=RT, 2=FFT(RT)
65  float Astart;
66  float Aend;
67  float Ainc;
68  float Rsigma; // 4*7 = 28 bytes
69  float Tstart;
70  float Tend;
71  float Tinc; // 4*3 = 12, 12+28 = 40B
72 
74  float weight; // For Maximum-Likelihood refinement
75  float flip; // 0=no flipping operation (false), 1=flipping (true)
76 
77  char fNada2[576]; // empty 700-76-40=624-40-8= 576 bytes
78 
79  char cdat[12]; // 211-213 creation date
80  char ctim[8]; // 214-215 creation time
81  char ctit[160]; // 216-255 title
82 } ;
83 
84 /************************************************************************
85 @Function: readSPIDER
86 @Description:
87  Reading a SPIDER image file format.
88 @Algorithm:
89  A 3D multi-image format used in electron microscopy.
90  Header size: 1024 bytes (not same as data offset!).
91  Data offset: sizeof(float)*x_size*ceil(1024/x_size)
92  File format extensions: .spi
93  Byte order determination: File type and third dimension values
94  must be less than 256*256.
95  Data type: only float.
96  Transform type: Hermitian
97  The x-dimension contains the x-size
98  of the full transform
99  A multi-image file has a global header followed by a header and data
100  for each sub-image.
101 @Arguments:
102  Bimage* p the image structure.
103  size_t select_img image selection in multi-image file (-1 = all images).
104 @Returns:
105  int error code (<0 means failure).
106 **************************************************************************/
110 int readSPIDER(size_t select_img);
111 
112 /************************************************************************
113 @Function: readSPIDER
114 @Description:
115  Reading a SPIDER image file format in batches.
116 @Arguments:
117  size_t start_img Number of first image in the batch.
118  size_t batch_size Specifies how many sub-images will be read.
119  If batch_size = ALL_IMAGES, then images from `start_img` to the last one will be read.
120 @Returns:
121  int error code (<0 means failure).
122 **************************************************************************/
126 int readSPIDER(size_t start_img, size_t batch_size);
127 
128 /************************************************************************
129 @Function: writeSPIDER
130 @Description:
131  Writing a SPIDER image file format.
132 @Algorithm:
133  A 3D image format used in electron microscopy.
134 @Arguments:
135 @Returns:
136  int error code (<0 means failure).
137 **************************************************************************/
141 int writeSPIDER(size_t select_img = ALL_IMAGES, bool isStack=false, int mode=WRITE_OVERWRITE);
142 #endif
float maxim
Definition: rwSPIDER.cpp:76
float phi2
Definition: rwSPIDER.cpp:83
float imami
Definition: rwSPIDER.cpp:56
float Astart
Definition: rwSPIDER.cpp:95
float lenbyt
Definition: rwSPIDER.cpp:73
float yoff
Definition: rwSPIDER.cpp:69
float labrec
Definition: rwSPIDER.cpp:63
double fGeo_matrix[3][3]
Definition: rwSPIDER.cpp:87
float psi1
Definition: rwSPIDER.cpp:82
float xoff
Definition: rwSPIDER.cpp:68
float labbyt
Definition: rwSPIDER.cpp:72
float ihist
Definition: rwSPIDER.cpp:61
float fAngle1
Definition: rwSPIDER.cpp:88
int readSPIDER(size_t select_img)
float scale
Definition: rwSPIDER.cpp:71
float iangle
Definition: rwSPIDER.cpp:64
float psi2
Definition: rwSPIDER.cpp:85
float fmin
Definition: rwSPIDER.cpp:58
float RTflag
Definition: rwSPIDER.cpp:94
char ctim[8]
Definition: rwSPIDER.cpp:110
float Tinc
Definition: rwSPIDER.cpp:101
char fNada2[576]
Definition: rwSPIDER.cpp:107
float fr1
Definition: rwSPIDER.cpp:90
float istack
Definition: rwSPIDER.cpp:74
float nslice
Definition: rwSPIDER.cpp:51
float Tstart
Definition: rwSPIDER.cpp:99
float nhistrec
Definition: rwSPIDER.cpp:54
float phi
Definition: rwSPIDER.cpp:65
float phi1
Definition: rwSPIDER.cpp:80
float weight
Definition: rwSPIDER.cpp:104
float imgnum
Definition: rwSPIDER.cpp:77
float nrow
Definition: rwSPIDER.cpp:52
float zoff
Definition: rwSPIDER.cpp:70
float iform
Definition: rwSPIDER.cpp:55
float fmax
Definition: rwSPIDER.cpp:57
float flip
Definition: rwSPIDER.cpp:105
float kangle
Definition: rwSPIDER.cpp:79
void mode
float sig
Definition: rwSPIDER.cpp:60
float theta2
Definition: rwSPIDER.cpp:84
float av
Definition: rwSPIDER.cpp:59
float fr2
Definition: rwSPIDER.cpp:91
float Tend
Definition: rwSPIDER.cpp:100
float theta
Definition: rwSPIDER.cpp:66
float Rsigma
Definition: rwSPIDER.cpp:98
char ctit[160]
Definition: rwSPIDER.cpp:111
#define ALL_IMAGES
float Aend
Definition: rwSPIDER.cpp:96
float inuse
Definition: rwSPIDER.cpp:75
float nsam
Definition: rwSPIDER.cpp:62
char cdat[12]
Definition: rwSPIDER.cpp:109
float theta1
Definition: rwSPIDER.cpp:81
float unused[2]
Definition: rwSPIDER.cpp:78
float irec
Definition: rwSPIDER.cpp:53
float gamma
Definition: rwSPIDER.cpp:67
float Ainc
Definition: rwSPIDER.cpp:97
int writeSPIDER(size_t select_img=ALL_IMAGES, bool isStack=false, int mode=WRITE_OVERWRITE)