code: def _make_data_from_components(
      components,
      affine=_affine_eye(),
      shape=SHAPE,
      rng=None,
      n_subjects=N_SUBJECTS,
  ):
      data = []
      if rng is None:
          rng = _rng()
      background = -0.01 * rng.normal(size=shape) - 2
      background = background[..., np.newaxis]
      for _ in range(n_subjects):
          this_data = np.dot(rng.normal(size=(40, 4)), components)
          this_data += 0.01 * rng.normal(size=this_data.shape)
          # Get back into 3D for CanICA
          this_data = np.reshape(this_data, (40,) + shape)
          this_data = np.rollaxis(this_data, 0, 4)
          # Put the border of the image to zero, to mimic a brain image
          this_data[:5] = background[:5]
          this_data[-5:] = background[-5:]
          this_data[:, :5] = background[:, :5]
          this_data[:, -5:] = background[:, -5:]
          data.append(Nifti1Image(this_data, affine))
      return data
  
imports: import numpy
  import pytest
  from nibabel import Nifti1Image
  from numpy.testing import assert_array_almost_equal
  from nilearn._utils.testing import write_imgs_to_path
  from nilearn.conftest import _affine_eye, _rng
  from nilearn.decomposition.canica import CanICA
  from nilearn.image import get_data, iter_img
  from nilearn.maskers import MultiNiftiMasker
label_desc: Use image node_id 1 for calling a global function with example usage: _make_data_from_components(components, affine, shape, rng, n_subjects) and returns: data