code: def test_mask():
      mean_image = np.ones((9, 9))
      mean_image[3:-3, 3:-3] = 10
      mean_image[5, 5] = 100
      mask1 = nnm.compute_mask(mean_image)
      mask2 = nnm.compute_mask(mean_image, exclude_zeros=True)
      # With an array with no zeros, exclude_zeros should not make
      # any difference
      assert_array_equal(mask1, mask2)
      # Check that padding with zeros does not change the extracted mask
      mean_image2 = np.zeros((30, 30))
      mean_image2[:9, :9] = mean_image
      mask3 = nnm.compute_mask(mean_image2, exclude_zeros=True)
      assert_array_equal(mask1, mask3[:9, :9])
      # However, without exclude_zeros, it does
      mask3 = nnm.compute_mask(mean_image2)
      assert not np.allclose(mask1, mask3[:9, :9])
      # check that  opening is 2 by default
      mask4 = nnm.compute_mask(
          mean_image, exclude_zeros=True, opening=2
      )
      assert_array_equal(mask1, mask4)
      # check that opening has an effect
      mask5 = nnm.compute_mask(
          mean_image, exclude_zeros=True, opening=0
      )
      assert mask5.sum() > mask4.sum()
  
file_path: nipy/nipy/labs/tests/test_mask.py
imports: import nibabel
  import numpy
  from nipy.testing import anatfile, assert_array_equal
  from ..None import mask
  from ..mask import largest_cc, series_from_mask, threshold_connect_components
label_desc: Use image node_id 3 for calling a global function with example usage: test_mask() without return types