Importing image from array and axis reorder

ITK indices, by convention, are [i,j,k] while NumPy indices are [k,j,i] by convention.

That is

itk_image.GetPixel([i,j,k])

is the same as

numpy_array_as_image[k,j,i]

With ITK 4.13.1, the keepAxes keyword argument to GetArrayFromImage can be used to reorder the array; in ITK 5, this will be keep_axes as we become more PEP8 compliant / Pythonic with the Python API. As noted in the documentation, the numpy operator here for GetImageFromArray to flip the image is numpy.reshape:

However, it is strongly recommended not to do this, because images will be flipped in matplotlib, etc. and it has memory usage and performance downsides.