summaryrefslogtreecommitdiff
path: root/src/e2e.h
blob: 167a83ad4b2921d6d1ea0f50d37bb1446c690027 (plain)
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
#include <inttypes.h>
#include "eli.h"

#define IMAGE_FUNDUS    0x02010201
#define IMAGE_TOMOGRAM  0x02200201

struct e2e_image {
	size_t size, width, height;
	uint32_t type;

	union {
		const uint8_t *fundus;
		float *tomogram;
	};
};

#define 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_data {
	const char *start, *end;

	struct e2e_directory *dirs;
};

int e2e_read(struct e2e_data *data, const char *start, const char *end);
void e2e_destroy(struct e2e_data *data);