#include #include #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; }; }; #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; 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);