code: def test_auto_mask():
      # This mostly a smoke test
      data = np.zeros((9, 9, 9))
      data[2:-2, 2:-2, 2:-2] = 10
      img = Nifti1Image(data, np.eye(4))
      masker = MultiNiftiMasker(mask_args=dict(opening=0))
      # Check that if we have not fit the masker we get a intelligible
      # error
      with pytest.raises(ValueError):
          masker.transform(
              [[img]],
          )
      # Check error return due to bad data format
      with pytest.raises(ValueError):
          masker.fit(img)
      # Smoke test the fit
      masker.fit([[img]])
  
      # Test mask intersection
      data2 = np.zeros((9, 9, 9))
      data2[1:-3, 1:-3, 1:-3] = 10
      img2 = Nifti1Image(data2, np.eye(4))
  
      masker.fit([[img, img2]])
      assert_array_equal(
          get_data(masker.mask_img_), np.logical_or(data, data2)
      )
      # Smoke test the transform
      masker.transform([[img]])
      # It should also work with a 3D image
      masker.transform(img)
  
      # check exception when transform() called without prior fit()
      masker2 = MultiNiftiMasker(mask_img=img)
      with pytest.raises(ValueError, match="has not been fitted. "):
          masker2.transform(img2)
  
imports: import shutil
  from tempfile import mkdtemp
  import numpy
  import pytest
  from joblib import Memory
  from nibabel import Nifti1Image
  from numpy.testing import assert_array_equal
  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
  from nilearn.maskers import MultiNiftiMasker
label_desc: Use image node_id 1 for calling a global function with example usage: test_auto_mask() without return types