class_docstr: Extract data from a SurfaceImage.
class_docstr_tok: ["Extract","data","from","a","SurfaceImage","."]
docstr: Extract signals from fitted surface object.
  
  Parameters
  ----------
  img : SurfaceImage object
      Mesh and data for both hemispheres.
  
  Returns
  -------
  output : numpy.ndarray
      Signal for each element.
      shape: (img data shape, total number of vertices)
docstr_tok: ["Extract","signals","from","fitted","surface","object",".","Parameters","--","--","--","--","--","img",":","SurfaceImage","object","Mesh","and","data","for","both","hemispheres",".","Returns","--","--","--","-","output",":","numpy.ndarray","Signal","for","each","element",".","shape",":","(","img","data","shape",",","total","number","of","vertices",")"]
code: def transform(
      self,
      img: SurfaceImage,
      confounds: pd.DataFrame | None = None,
      sample_mask: np.ndarray | None = None,
  ) -> np.ndarray:
      """Extract signals from fitted surface object.
  
      Parameters
      ----------
      img : SurfaceImage object
          Mesh and data for both hemispheres.
  
      Returns
      -------
      output : numpy.ndarray
          Signal for each element.
          shape: (img data shape, total number of vertices)
      """
      parameters = get_params(
          self.__class__,
          self,
          ignore=[
              "mask_img",
          ],
      )
      parameters["clean_kwargs"] = self.clean_kwargs
  
      self._check_fitted()
      assert self.mask_img_ is not None
      assert self.output_dimension_ is not None
      check_same_n_vertices(self.mask_img_.mesh, img.mesh)
      output = np.empty((*img.shape[:-1], self.output_dimension_))
      for part_name, (start, stop) in self.slices.items():
          mask = self.mask_img_.data[part_name]
          assert isinstance(mask, np.ndarray)
          output[..., start:stop] = img.data[part_name][..., mask]
  
      # signal cleaning here
      output = cache(
          signal.clean,
          memory=self.memory,
          func_memory_level=2,
          memory_level=self.memory_level,
          shelve=self._shelving,
      )(
          output,
          detrend=parameters["detrend"],
          standardize=parameters["standardize"],
          standardize_confounds=parameters["standardize_confounds"],
          t_r=parameters["t_r"],
          low_pass=parameters["low_pass"],
          high_pass=parameters["high_pass"],
          confounds=confounds,
          sample_mask=sample_mask,
          **parameters["clean_kwargs"],
      )
      return output
  
imports: from __future__ import annotations
  from typing import Any
  import numpy
  import pandas
  from joblib import Memory
  from sklearn.base import BaseEstimator, TransformerMixin
  from nilearn import signal
  from nilearn._utils.cache_mixin import CacheMixin, cache
  from nilearn._utils.class_inspect import get_params
  from nilearn.experimental.surface._surface_image import PolyMesh, SurfaceImage
label_desc: Use image node_id 5 for calling the SurfaceMasker obj's underlying member method code with example usage: obj.transform(img, confounds, sample_mask) and returns: output