code: def test_3d_images():
      # Test that the NiftiLabelsMasker works with 3D images
      affine = np.eye(4)
      n_regions = 3
      shape3 = (2, 2, 2)
  
      labels33_img = data_gen.generate_labeled_regions(
          shape3, n_regions
      )
      mask_img = nibabel.Nifti1Image(
          np.ones(shape3, dtype=np.int8),
          affine=affine,
      )
      epi_img1 = nibabel.Nifti1Image(np.ones(shape3), affine=affine)
      epi_img2 = nibabel.Nifti1Image(np.ones(shape3), affine=affine)
      masker = NiftiLabelsMasker(labels33_img, mask_img=mask_img)
  
      epis = masker.fit_transform(epi_img1)
      assert epis.shape == (1, 3)
      epis = masker.fit_transform([epi_img1, epi_img2])
      assert epis.shape == (2, 3)
  
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 12 for calling a global function with example usage: test_3d_images() without return types