I am doing some work in which I have to load CT manipulation images in the Analyze 7.5 file format .
Part of this manipulation, which takes absolutely age with large images, loads the raw binary data into a numpy array and converts them to the correct sizes. Here is an example:
headshape = (512,512,245)
I know that numpy can quickly convert arrays, but I can't figure out the right combination of transforms needed to replicate the effect of nested loops.
Is there any way to reproduce this weird indexing with some combination of numpy.reshape / numpy.ravel etc.
source share