code: def test_resampling_result_axis_permutation(
      affine_eye, axis_permutation
  ):
      """Transform real data using easily checkable transformations.
  
      For now: axis permutations
      create a cuboid full of deterministic data, padded with one
      voxel thickness of zeros
      """
      core_shape = (3, 5, 4)
      core_data = np.arange(np.prod(core_shape)).reshape(core_shape)
      full_data_shape = np.array(core_shape) + 2
      full_data = np.zeros(full_data_shape)
      full_data[tuple(slice(1, 1 + s) for s in core_shape)] = core_data
  
      source_img = Nifti1Image(full_data, affine_eye)
  
      # check 3x3 transformation matrix
      target_affine = np.eye(3)[axis_permutation]
  
      resampled_img = resample_img(
          source_img, target_affine=target_affine
      )
  
      resampled_data = get_data(resampled_img)
      expected_data = full_data.transpose(axis_permutation)
      assert_array_almost_equal(resampled_data, expected_data)
  
      # check 4x4 transformation matrix
      offset = np.array([-2, 1, -3])
  
      target_affine = affine_eye
      target_affine[:3, :3] = np.eye(3)[axis_permutation]
      target_affine[:3, 3] = offset
  
      resampled_img = resample_img(
          source_img, target_affine=target_affine
      )
  
      resampled_data = get_data(resampled_img)
      offset_cropping = (
          np.vstack(
              [
                  -offset[axis_permutation][np.newaxis, :],
                  np.zeros([1, 3]),
              ]
          )
          .T.ravel()
          .astype(int)
      )
      expected_data = _pad_array(
          full_data.transpose(axis_permutation), list(offset_cropping)
      )
      assert_array_almost_equal(resampled_data, expected_data)
  
imports: import copy
  import math
  import os
  from pathlib import Path
  import numpy
  import pytest
  from nibabel import Nifti1Header, Nifti1Image
  from nibabel.freesurfer import MGHImage
  from numpy.testing import assert_allclose, assert_almost_equal, assert_array_almost_equal, assert_array_equal, assert_equal
  from nilearn import _utils
  from nilearn._utils import testing
  from nilearn.conftest import _affine_eye, _rng
  from nilearn.image import get_data
  from nilearn.image.image import _pad_array, crop_img
  from nilearn.image.resampling import BoundingBoxError, coord_transform, from_matrix_vector, get_bounds, reorder_img, resample_img, resample_to_img
label_desc: Use image node_id 19 for calling a global function with example usage: test_resampling_result_axis_permutation(affine_eye, axis_permutation) without return types