:doc:`affine_transform <resampling_with_ndimage>` works by using voxel coordinate implied by the output_shape, and transforming those. See: :ref:`implied-coordinate-grid`. numpy.meshgrid is a way of ...
Me and @pedrohasselmann found a strange issue when using numpy.meshgrid for 3 dimensions and higher. The axis of each grid are shuffled and are not returned in the same order in which they were given.