code: def test_missing_labels_due_to_resampling(affine_eye):
      """Test region_names_ matches signals after resampling drops labels."""
      shape = (13, 11, 12, 3)
      affine_low = np.diag((4, 4, 4, 4))
      fmri_img, _ = data_gen.generate_random_img(
          shape, affine=affine_low
      )
      labels_img = data_gen.generate_labeled_regions(
          shape[:3],
          affine=affine_eye,
          n_regions=7,
      )
  
      # define region_names
      region_names = ["background"] + [
          "region_" + str(i + 1) for i in range(7)
      ]
  
      masker = NiftiLabelsMasker(
          labels_img,
          labels=region_names,
          resampling_target="data",
      )
      signals = masker.fit().transform(fmri_img)
  
      assert len(masker.region_names_) == signals.shape[1]
      assert (
          len(list(masker.region_ids_.items())[1:]) == signals.shape[1]
      )
  
imports: import warnings
  import nibabel
  import numpy
  import pytest
  from nilearn._utils import data_gen, testing
  from nilearn._utils.exceptions import DimensionError
  from nilearn.image import get_data
  from nilearn.maskers import NiftiLabelsMasker, NiftiMasker
label_desc: Use image node_id 11 for calling a global function with example usage: test_missing_labels_due_to_resampling(affine_eye) without return types