code: def test_compute_epi_mask(affine_eye):
      mean_image = np.ones((9, 9, 3))
      mean_image[3:-2, 3:-2, :] = 10
      mean_image[5, 5, :] = 11
      mean_image = Nifti1Image(mean_image, affine_eye)
      mask1 = compute_epi_mask(mean_image, opening=False)
      mask2 = compute_epi_mask(
          mean_image, exclude_zeros=True, opening=False
      )
      # With an array with no zeros, exclude_zeros should not make
      # any difference
      np.testing.assert_array_equal(get_data(mask1), get_data(mask2))
      # Check that padding with zeros does not change the extracted mask
      mean_image2 = np.zeros((30, 30, 3))
      mean_image2[3:12, 3:12, :] = get_data(mean_image)
      mean_image2 = Nifti1Image(mean_image2, affine_eye)
      mask3 = compute_epi_mask(
          mean_image2, exclude_zeros=True, opening=False
      )
      np.testing.assert_array_equal(
          get_data(mask1), get_data(mask3)[3:12, 3:12]
      )
      # However, without exclude_zeros, it does
      mask3 = compute_epi_mask(mean_image2, opening=False)
      assert not np.allclose(
          get_data(mask1), get_data(mask3)[3:12, 3:12]
      )
  
      # Check that we get a ValueError for incorrect shape
      mean_image = np.ones((9, 9))
      mean_image[3:-3, 3:-3] = 10
      mean_image[5, 5] = 100
      mean_image = Nifti1Image(mean_image, affine_eye)
      with pytest.raises(ValueError):
          compute_epi_mask(mean_image)
  
      # Check that we get a useful warning for empty masks
      mean_image = np.zeros((9, 9, 9))
      mean_image[0, 0, 1] = -1
      mean_image[0, 0, 0] = 1.2
      mean_image[0, 0, 2] = 1.1
      mean_image = Nifti1Image(mean_image, affine_eye)
      with pytest.warns(_MaskWarning, match="Computed an empty mask"):
          compute_epi_mask(mean_image, exclude_zeros=True)
  
imports: import warnings
  import numpy
  import pytest
  from nibabel import Nifti1Image
  from numpy.testing import assert_array_equal
  from sklearn.preprocessing import StandardScaler
  from nilearn import masking
  from nilearn._utils import data_gen
  from nilearn._utils.exceptions import DimensionError
  from nilearn._utils.testing import write_imgs_to_path
  from nilearn.conftest import _rng
  from nilearn.image import get_data, high_variance_confounds
  from nilearn.maskers import NiftiMasker
  from nilearn.masking import _MaskWarning, _unmask_3d, _unmask_4d, compute_background_mask, compute_brain_mask, compute_epi_mask, compute_multi_brain_mask, compute_multi_epi_mask, extrapolate_out_mask, intersect_masks, unmask, unmask_from_to_3d_array
label_desc: Use image node_id 6 for calling a global function with example usage: test_compute_epi_mask(affine_eye) without return types