Numpy N-D rot90 flip

Rotating 3-D arrays in Python became much more straightforward with Numpy ≥ 1.12. For this example, assume

data.shape == (256,128,128)

New N-D flip rot90 Numpy ≥ 1.12


numpy.flip has also been upgraded to N-dimensional arrays, similarly avoiding the awkward transpose above.

OBSOLETE, awkward 3-D rotate Numpy < 1.12

This is the equivalent of the new numpy.rot90 syntax above

np.rot90(data.transpose(1,2,0), 2).transpose(2,0,1)