class_docstr: Extract data from a SurfaceImage, averaging over atlas regions.
  
  Parameters
  ----------
  labels_img : SurfaceImage object
      Region definitions, as one image of labels.
  
  label_names : :obj:`list` of :obj:`str`, default=None
      Full labels corresponding to the labels image.
  
  Attributes
  ----------
  labels_data_ : :obj:`numpy.ndarray`
  
  labels_ : :obj:`numpy.ndarray`
  
  label_names_ : :obj:`numpy.ndarray`
class_docstr_tok: ["Extract","data","from","a","SurfaceImage",",","averaging","over","atlas","regions",".","Parameters","--","--","--","--","--","labels_img",":","SurfaceImage","object","Region","definitions",",","as","one","image","of","labels",".","label_names",":",":","obj",":","`","list","`","of",":","obj",":","`","str","`",",","default=None","Full","labels","corresponding","to","the","labels","image",".","Attributes","--","--","--","--","--","labels_data_",":",":","obj",":","`","numpy.ndarray","`","labels_",":",":","obj",":","`","numpy.ndarray","`","label_names_",":",":","obj",":","`","numpy.ndarray","`"]
code: def __init__(
      self,
      labels_img: SurfaceImage,
      label_names: dict[Any, str] | None = None,
  ) -> None:
      self.labels_img = labels_img
      self.label_names = label_names
      self.labels_data_ = np.concatenate(list(labels_img.data.values()))
      all_labels = set(self.labels_data_.ravel())
      all_labels.discard(0)
      self.labels_ = np.asarray(list(all_labels))
      if label_names is None:
          self.label_names_ = np.asarray(
              [str(label) for label in self.labels_]
          )
      else:
          self.label_names_ = np.asarray(
              [label_names[label] for label in self.labels_]
          )
  
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 1 to create a new SurfaceLabelsMasker object  with example: obj = SurfaceLabelsMasker(labels_img, label_names)