Equivalent flipdimin MATLAB flip's numpy. Keep in mind that this is only available in version 1.12.0.
Therefore, it is simple:
import numpy as np
def flipall(X):
Xcopy = X.copy()
for i in range(X.ndim):
Xcopy = np.flip(Xcopy, i)
return Xcopy
So you simply name it like this:
Xflip = flipall(X)
However, if you know a priori that you have only three dimensions, you can hard code the operation by simply doing:
def flipall(X):
return X[::-1,::-1,::-1]
.
1.12.0 ( hpaulj), slice :
import numpy as np
def flipall(X):
return X[[slice(None,None,-1) for _ in X.shape]]