code: def test_reorder_img(affine_eye, rng):
      # We need to test on a square array, as rotation does not change
      # shape, whereas reordering does.
      shape = (5, 5, 5, 2, 2)
      data = rng.uniform(size=shape)
      affine = affine_eye
      affine[:3, -1] = 0.5 * np.array(shape[:3])
      ref_img = Nifti1Image(data, affine)
  
      # Test with purely positive matrices and compare to a rotation
      for theta, phi in rng.integers(4, size=(5, 2)):
          rot = rotation(theta * np.pi / 2, phi * np.pi / 2)
          rot[np.abs(rot) < 0.001] = 0
          rot[rot > 0.9] = 1
          rot[rot < -0.9] = 1
          b = 0.5 * np.array(shape[:3])
          new_affine = from_matrix_vector(rot, b)
  
          rot_img = resample_img(ref_img, target_affine=new_affine)
  
          assert_array_equal(rot_img.affine, new_affine)
          assert_array_equal(get_data(rot_img).shape, shape)
  
          reordered_img = reorder_img(rot_img)
  
          assert_array_equal(reordered_img.affine[:3, :3], np.eye(3))
          assert_almost_equal(get_data(reordered_img), 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 26 for calling a global function with example usage: test_reorder_img(affine_eye, rng) without return types