|
1 | | -use core::f32; |
2 | | - |
3 | 1 | #[repr(C, align(4))] |
4 | 2 | #[derive(Debug, Clone, Copy, PartialEq)] |
5 | | -#[non_exhaustive] |
6 | 3 | pub struct Header { |
| 4 | + /// number of columns in 3D data array (fast axis) |
7 | 5 | pub nx: i32, |
| 6 | + /// Number of rows in 3D data array (medium axis) |
8 | 7 | pub ny: i32, |
| 8 | + /// Number of sections in 3D data array (slow axis) |
9 | 9 | pub nz: i32, |
| 10 | + /// Mode value (see `Mode` enum) |
10 | 11 | pub mode: i32, |
| 12 | + /// Location of first column in unit cell |
11 | 13 | pub nxstart: i32, |
| 14 | + /// Location of first row in unit cell |
12 | 15 | pub nystart: i32, |
| 16 | + /// Location of first section in unit cell |
13 | 17 | pub nzstart: i32, |
| 18 | + /// Sampling along X axis of unit cell |
14 | 19 | pub mx: i32, |
| 20 | + /// Sampling along Y axis of unit cell |
15 | 21 | pub my: i32, |
| 22 | + /// Sampling along Z axis of unit cell |
16 | 23 | pub mz: i32, |
17 | | - pub xlen: f32, // Unit cell edge length along X (Å). |
18 | | - pub ylen: f32, // Unit cell edge length along Y (Å). |
19 | | - pub zlen: f32, // Unit cell edge length along Z (Å). |
20 | | - pub alpha: f32, // Angle between Y and Z axes (degrees). |
21 | | - pub beta: f32, // Angle between X and Z axes (degrees). |
22 | | - pub gamma: f32, // Angle between X and Y axes (degrees). |
23 | | - pub mapc: i32, // 1-based index of column axis (1 = X, 2 = Y, 3 = Z). |
24 | | - pub mapr: i32, // 1-based index of row axis. |
25 | | - pub maps: i32, // 1-based index of section axis. |
26 | | - pub dmin: f32, // Minimum density value. |
27 | | - pub dmax: f32, // Maximum density value. |
28 | | - pub dmean: f32, // Mean density value. |
29 | | - pub ispg: i32, // Space-group number (1 = P1). |
30 | | - pub nsymbt: i32, // Bytes of symmetry data following the header. |
31 | | - pub extra: [u8; 100], // Reserved; bytes 8–11 hold EXTTYP, 12–15 NVERSION. |
32 | | - pub origin: [f32; 3], // Volume origin in voxels. |
33 | | - pub map: [u8; 4], // Magic bytes “MAP ”. |
34 | | - pub machst: [u8; 4], // Machine stamp (little-endian: 0x44 0x44 0x00 0x00). |
35 | | - pub rms: f32, // RMS deviation of density values. |
36 | | - pub nlabl: i32, // Number of valid labels (0–10). |
37 | | - pub label: [u8; 800], // Ten 80-byte text labels. |
| 24 | + /// CELLA: Cell dimensions (unit cell edge length) in Angstroms (Å) along X axis |
| 25 | + pub xlen: f32, |
| 26 | + /// CELLA: Cell dimensions (unit cell edge length) in Angstroms (Å) along Y axis |
| 27 | + pub ylen: f32, |
| 28 | + /// CELLA: Cell dimensions (unit cell edge length) in Angstroms (Å) along Z axis |
| 29 | + pub zlen: f32, |
| 30 | + /// CELLB: Cell angles in degrees between the crystallographic axes Y and Z axes |
| 31 | + pub alpha: f32, |
| 32 | + /// CELLB: Cell angles in degrees between the crystallographic axes X and Z axes |
| 33 | + pub beta: f32, |
| 34 | + /// CELLB: Cell angles in degrees between the crystallographic axes X and Y axes |
| 35 | + pub gamma: f32, |
| 36 | + /// 1-based index of column axis (1,2,3 for X,Y,Z) |
| 37 | + pub mapc: i32, |
| 38 | + /// 1-based index of row axis (1,2,3 for X,Y,Z) |
| 39 | + pub mapr: i32, |
| 40 | + /// 1-based index of section axis (1,2,3 for X,Y,Z) |
| 41 | + pub maps: i32, |
| 42 | + /// Minimum density value |
| 43 | + pub dmin: f32, |
| 44 | + /// Maximum density value |
| 45 | + pub dmax: f32, |
| 46 | + /// Mean density value |
| 47 | + pub dmean: f32, |
| 48 | + /// Space group number; 0 implies 2D image or image stack. |
| 49 | + /// For crystallography, represents the actual spacegroup. |
| 50 | + /// For volume stacks, conventionally ISPG = spacegroup number + 400. |
| 51 | + pub ispg: i32, |
| 52 | + /// Size of extended header record ("symmetry data") in bytes. |
| 53 | + pub nsymbt: i32, |
| 54 | + /// Extra space used for anything. |
| 55 | + /// Bytes 8–11 hold EXTTYP, 12–15 NVERSION. |
| 56 | + pub extra: [u8; 100], |
| 57 | + /// Volume/phase origin (pixels/voxels) or origin of subvolume |
| 58 | + pub origin: [f32; 3], |
| 59 | + /// Must contain "MAP " to identify file type |
| 60 | + pub map: [u8; 4], |
| 61 | + /// Machine stamp that encodes byte order of data |
| 62 | + /// (little-endian: 0x44 0x44 0x00 0x00) |
| 63 | + pub machst: [u8; 4], |
| 64 | + /// RMS deviation of map from mean density |
| 65 | + pub rms: f32, |
| 66 | + /// Number of valid labels in `label` field (0–10) |
| 67 | + pub nlabl: i32, |
| 68 | + /// 10 text labels of 80 bytes each |
| 69 | + pub label: [u8; 800], |
38 | 70 | } |
39 | 71 |
|
40 | 72 | impl Default for Header { |
|
0 commit comments