code: def test_modify():
      shape = (3, 5, 7, 12)
      x = np.random.standard_normal(shape)
      affine = np.eye(5)
      affine[:3, :3] = np.random.standard_normal((3, 3))
      affine[:4, 4] = np.random.standard_normal((4,))
      im = Image(x, AT(CS("ijkq"), MNI4, affine))
  
      def nullmodify(d):
          pass
  
      def meanmodify(d):
          d[:] = d.mean()
  
      for i, o, n in zip("ijkq", MNI3.coord_names + ("q",), range(4)):
          for a in i, o, n:
              nullim = image_modify(im, nullmodify, a)
              meanim = image_modify(im, meanmodify, a)
              assert_array_equal(nullim.get_fdata(), im.get_fdata())
              assert_array_equal(xyz_affine(im), xyz_affine(nullim))
              assert nullim.axes == im.axes
              assert_array_equal(xyz_affine(im), xyz_affine(meanim))
              assert meanim.axes == im.axes
          # Make sure that meanmodify works as expected
          d = im.get_fdata()
          d = np.rollaxis(d, n)
          meand = meanim.get_fdata()
          meand = np.rollaxis(meand, n)
          for i in range(d.shape[0]):
              assert_almost_equal(meand[i], d[i].mean())
  
file_path: nipy/nipy/core/image/tests/test_rollimg.py
imports: import numpy
  import pytest
  from numpy.testing import assert_almost_equal, assert_array_equal
  from ...image.image_spaces import xyz_affine
  from ...reference.coordinate_map import AffineTransform
  from ...reference.coordinate_map import AxisError, drop_io_dim
  from ...reference.coordinate_system import CoordinateSystem
  from ...reference.spaces import mni_csm
  from ..image import Image, rollimg, synchronized_order
label_desc: Use image node_id 8 for calling a global function with example usage: test_modify() without return types