code: def test_masked_indices():
      mask = np.ones((4, 3, 8))
      mask[:, :, ::2] = 0
      locations = np.mgrid[:5, :3, :8].ravel().reshape((3, -1))
      masked = surface._masked_indices(locations.T, mask.shape, mask)
      # These elements are masked by the mask
      assert (masked[::2] == 1).all()
      # The last element of locations is one row beyond first image dimension
      assert (masked[-24:] == 1).all()
      # 4 * 3 * 8 / 2 elements should remain unmasked
      assert (1 - masked).sum() == 48
  
imports: import os
  import tempfile
  import warnings
  import nibabel
  import numpy
  import pytest
  from nibabel import gifti
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from scipy.spatial import Delaunay
  from scipy.stats import pearsonr
  from nilearn import datasets, image
  from nilearn._utils import data_gen
  from nilearn.image import resampling
  from nilearn.surface import Mesh, Surface, load_surf_data, load_surf_mesh, surface
  from nilearn.surface.surface import _gifti_img_to_mesh, _load_surf_files_gifti_gzip
  from nilearn.surface.tests._testing import flat_mesh, generate_surf, z_const_img
label_desc: Use image node_id 26 for calling a global function with example usage: test_masked_indices() without return types