code: def test_parcellations_transform_single_nifti_image(
      method, n_parcel, test_image_2
  ):
      """Test with NiftiLabelsMasker extraction of timeseries data
      after building a parcellations image.
  
      """
      parcellator = Parcellations(
          method=method, n_parcels=n_parcel, verbose=0
      )
      parcellator.fit(test_image_2)
      # transform to signals
      signals = parcellator.transform(test_image_2)
  
      # Test if the signals extracted are of same shape as inputs
      # Here, we simply return numpy array for single subject input
      assert signals.shape == (test_image_2.shape[3], n_parcel)
      # Test for single subject but in a list.
      signals = parcellator.transform([test_image_2])
      assert signals.shape == (test_image_2.shape[3], n_parcel)
  
imports: import warnings
  import numpy
  import pandas
  import pytest
  from nibabel import Nifti1Image
  from nilearn.conftest import _affine_eye
  from nilearn.regions.parcellations import Parcellations, _check_parameters_transform
label_desc: Use image node_id 9 for calling a global function with example usage: test_parcellations_transform_single_nifti_image(method, n_parcel, test_image_2) without return types