I have an about 537 byte file which holds an image in some proprietary format. All I know is, that it is pure binary data consists of 4 byte floats (each voxel is a 4 byte float with a density value).
If I simply open the file via open()
with open(filename, 'rb') as f:
s = f.read()
how can I iterate over the file and print the voxel values? It I simple use
print(s)
I get an error "IOPub data rate exceeded." Of course, I can fix this with, e.g.,
jupyter notebook --NotebookApp.iopub_data_rate_limit=10000000000
Then I get something like this
b'\x00\x00\x00\x00\x00\x00\x00\x00_2w:\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xcd\xdb\xcd:\n0\x12:\x00\x00\x00\x00V\t<:\xf1\xb2\x06;\x8f\xeb\x9c:\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x91\x14\x8c:\x00\x00\x00\x00\x00\x00\x00\x00sR\xbb9\x9e?\x8f:\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc6\xb1^9\x00\x00\x00\x00\x00\x00\x00\x000\xcd\xd49\xc5bO:\xe0\xa9\x849\xf7\x05\x0f::\xb6\x93:\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00q\xdbb9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \xf2\x11:\xd3eN9\xa5OQ9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00f\x85~7\x00\x00\x00\x00\x00\x00\x00\x00\x8fV\x959d\x98U:\x00\x00\x00\x00>\xa3\x8d8\x00\x00\x00\x00\xe4\x07~:\x00\x00\x00\x00\x00\x00\x00\x00\x13\xc0b9\x00\x00\x00\x00\xdb \r:,3\xf1:\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00v\xfb\xc49\x9b\x10g:\xfa-\xc7:\xd8j\x86:G\x08\x19:\x00\x00\x00\x00\x83\xc88:\x86Xs9\x1a-\x8f9\xf3\xc1\x00;\xf4\x85I:\x8e\x0f\xeb9\xceP\xb0:x@\xb9:\xe0\x02Z;\xef\xc1,:\xdd\xb8\xa8:\xd5\x94\xc1:\x96EG:L\xf0_:\x00\x00\x00\x00\x00\x00\x00\x00\x153\x00;8\xf2\xce:H\x00\x82:\x8f\xae\xe4:V\xe6\xe6:\x00
What I really want is just a list of my 4 byte floats.
Any ideas?
All the best!