class_docstr: Extract data from a SurfaceImage.
class_docstr_tok: ["Extract","data","from","a","SurfaceImage","."]
code: def _fit_mask_img(self, img: SurfaceImage | None) -> None:
      if self.mask_img is not None:
          if img is not None:
              check_same_n_vertices(self.mask_img.mesh, img.mesh)
          self.mask_img_ = self.mask_img
          return
      if img is None:
          raise ValueError(
              "Please provide either a mask_img when initializing "
              "the masker or an img when calling fit()."
          )
      # TODO: don't store a full array of 1 to mean "no masking"; use some
      # sentinel value
      mask_data = {
          k: np.ones(v.n_vertices, dtype=bool)
          for (k, v) in img.mesh.items()
      }
      self.mask_img_ = SurfaceImage(mesh=img.mesh, data=mask_data)
  
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 2 for calling the SurfaceMasker obj's underlying member method code with example usage: obj._fit_mask_img(img) without return types