1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
#include <inttypes.h>
#include <uthash.h>
#include "eli.h"
#define E2E_NONE 0xffffffff
#define E2E_IMAGE_FUNDUS 0x02010201
#define E2E_IMAGE_TOMOGRAM 0x02200201
struct e2e_image {
size_t size, width, height;
uint32_t type;
union {
const uint8_t *fundus;
float *tomogram;
};
eli_header series_fundi_list;
};
#define E2E_CHUNK_IMAGE 0x40000000
struct e2e_chunk {
const char *origin;
const struct e2e_entry *entry;
size_t size;
uint32_t patient_id, study_id, series_id, slice_id, ind;
uint32_t type;
union {
struct e2e_image image;
};
};
struct e2e_entry {
const char *start;
size_t size;
uint32_t patient_id, study_id, series_id, slice_id, type;
_Bool has_chunk;
struct e2e_chunk chunk;
};
struct e2e_fundus {
size_t size, width, height;
uint32_t type;
};
struct e2e_directory {
const char *current, *next;
size_t num_entries;
struct e2e_entry *entries;
eli_header data_list;
};
struct e2e_slice {
int id;
struct e2e_image *image;
UT_hash_handle hh;
};
struct e2e_series {
int id;
struct e2e_slice *slices;
size_t num_fundi;
struct e2e_image *fundi;
UT_hash_handle hh;
};
struct e2e_study {
int id;
struct e2e_series *series;
UT_hash_handle hh;
};
struct e2e_patient {
int id; // FIXME: hopefully this doesn't overflow...
struct e2e_study *studies;
UT_hash_handle hh;
};
struct e2e_data {
// file buffer
const char *start, *end;
// E2E structure
struct e2e_directory *dirs;
// logical structure
struct e2e_patient *patients;
};
int e2e_read(struct e2e_data *data, const char *start, const char *end);
void e2e_destroy(struct e2e_data *data);
|