code: def test_reorder_img_flipping_axis(affine_eye, rng):
      shape = (5, 5, 5, 2, 2)
  
      data = rng.uniform(size=shape)
  
      for i in (0, 1, 2):
          # Make a diagonal affine with a negative axis, and check that
          # can be reordered, also vary the shape
          shape = (i + 1, i + 2, 3 - i)
          affine = affine_eye
          affine[i, i] *= -1
  
          img = Nifti1Image(data, affine)
          orig_img = copy.copy(img)
  
          img2 = reorder_img(img)
  
          # Check that img has not been changed
          assert_array_equal(img.affine, orig_img.affine)
          assert_array_equal(get_data(img), get_data(orig_img))
  
          # Test that the affine is indeed diagonal:
          assert_array_equal(
              img2.affine[:3, :3], np.diag(np.diag(img2.affine[:3, :3]))
          )
          assert np.all(np.diag(img2.affine) >= 0)
  
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 29 for calling a global function with example usage: test_reorder_img_flipping_axis(affine_eye, rng) without return types