code: def test_find_cut_slices(affine_eye):
      data = np.zeros((50, 50, 50))
      x_map, y_map, z_map = 25, 5, 20
      data[
          x_map - 15 : x_map + 15,
          y_map - 3 : y_map + 3,
          z_map - 10 : z_map + 10,
      ] = 1
      img = nibabel.Nifti1Image(data, affine_eye)
      for n_cuts in (2, 4):
          for direction in "xz":
              cuts = find_cut_slices(
                  img, direction=direction, n_cuts=n_cuts, spacing=2
              )
              # Test that we are indeed getting the right number of cuts
              assert len(cuts) == n_cuts
              # Test that we are not getting cuts that are separated by
              # less than the minimum spacing that we asked for
              assert np.diff(cuts).min() == 2
              # Test that the cuts indeed go through the 'activated' part
              # of the data
              for cut in cuts:
                  if direction == "x":
                      cut_value = data[int(cut)]
                  elif direction == "z":
                      cut_value = data[..., int(cut)]
                  assert cut_value.max() == 1
  
      # Now ask more cuts than it is possible to have with a given spacing
      n_cuts = 15
      for direction in "xz":
          # Only a smoke test
          cuts = find_cut_slices(
              img, direction=direction, n_cuts=n_cuts, spacing=2
          )
  
      # non-diagonal affines
      affine = np.array(
          [
              [-1.0, 0.0, 0.0, 123.46980286],
              [0.0, 0.0, 1.0, -94.11079407],
              [0.0, -1.0, 0.0, 160.694],
              [0.0, 0.0, 0.0, 1.0],
          ]
      )
      img = nibabel.Nifti1Image(data, affine)
      cuts = find_cut_slices(img, direction="z")
      assert np.diff(cuts).min() != 0.0
      affine = np.array(
          [
              [-2.0, 0.0, 0.0, 123.46980286],
              [0.0, 0.0, 2.0, -94.11079407],
              [0.0, -2.0, 0.0, 160.694],
              [0.0, 0.0, 0.0, 1.0],
          ]
      )
      img = nibabel.Nifti1Image(data, affine)
      cuts = find_cut_slices(img, direction="z")
      assert np.diff(cuts).min() != 0.0
      # Rotate it slightly
      angle = np.pi / 180 * 15
      rotation_matrix = np.array(
          [
              [np.cos(angle), -np.sin(angle)],
              [np.sin(angle), np.cos(angle)],
          ]
      )
      affine[:2, :2] = rotation_matrix * 2.0
      img = nibabel.Nifti1Image(data, affine)
      cuts = find_cut_slices(img, direction="z")
      assert np.diff(cuts).min() != 0.0
  
file_path: nilearn/nilearn/plotting/tests/test_find_cuts.py
imports: import nibabel
  import numpy
  import pytest
  from nilearn.masking import compute_epi_mask
  from nilearn.plotting.find_cuts import _transform_cut_coords, find_cut_slices, find_parcellation_cut_coords, find_probabilistic_atlas_cut_coords, find_xyz_cut_coords
label_desc: Use image node_id 2 for calling a global function with example usage: test_find_cut_slices(affine_eye) without return types