the cub file format is quite easy. The first three uint32_t values are the width, depth and height (little endian) values of the following volume data. The volume data itself is stored in 3 bytes for RGB