code: def view_img_on_surf(
      stat_map_img,
      surf_mesh="fsaverage5",
      threshold=None,
      cmap=cm.cold_hot,
      black_bg=False,
      vmax=None,
      vmin=None,
      symmetric_cmap=True,
      bg_on_data=False,
      darkness=0.7,
      colorbar=True,
      colorbar_height=0.5,
      colorbar_fontsize=25,
      title=None,
      title_fontsize=25,
      vol_to_surf_kwargs={},
  ):
      """Insert a surface plot of a statistical map into an HTML page.
  
      Parameters
      ----------
      stat_map_img : Niimg-like object, 3D
          See :ref:`extracting_data`.
  
      surf_mesh : str or dict, default='fsaverage5'
          If a string, it should be one of the following values:
          %(fsaverage_options)s
          If a dictionary, it should have the same structure as those returned by
          nilearn.datasets.fetch_surf_fsaverage, i.e. keys should be 'infl_left',
          'pial_left', 'sulc_left', 'infl_right', 'pial_right', and 'sulc_right',
          containing inflated and pial meshes, and sulcal depth values for left
          and right hemispheres.
  
      threshold : str, number or None, optional
          If None, no thresholding.
          If it is a number only values of amplitude greater
          than threshold will be shown.
          If it is a string it must finish with a percent sign,
          e.g. "25.3%%", and only values of amplitude above the
          given percentile will be shown.
  
      cmap : str or matplotlib colormap, default=cm.cold_hot
          Colormap to use.
  
      black_bg : bool, default=False
          If True, image is plotted on a black background. Otherwise on a
          white background.
  
      %(bg_on_data)s
  
      %(darkness)s
          Default=1.
  
      vmax : float or None, optional
          upper bound for the colorbar. if None, use the absolute max of the
          brain map.
  
      vmin : float or None, optional
          min value for mapping colors.
          If `symmetric_cmap` is `True`, `vmin` is always equal to `-vmax` and
          cannot be chosen.
          If `symmetric_cmap` is `False`, `vmin` is equal to the min of the
          image, or 0 when a threshold is used.
  
      symmetric_cmap : bool, default=True
          Make colormap symmetric (ranging from -vmax to vmax).
          You can set it to False if you are plotting only positive values.
  
      colorbar : bool, default=True
          Add a colorbar or not.
  
      colorbar_height : float, default=0.5
          Height of the colorbar, relative to the figure height
  
      colorbar_fontsize : int, default=25
          Fontsize of the colorbar tick labels.
  
      title : str, optional
          Title for the plot.
  
      title_fontsize : int, default=25
          Fontsize of the title.
  
      vol_to_surf_kwargs : dict, optional
          Dictionary of keyword arguments that are passed on to
          :func:`nilearn.surface.vol_to_surf` when extracting a surface from
          the input image. See the function documentation for details.This
          parameter is especially useful when plotting an atlas. See
          https://nilearn.github.io/stable/auto_examples/01_plotting/plot_3d_map_to_surface_projection.html
  
      Returns
      -------
      SurfaceView : plot of the stat map.
          It can be saved as an html page or rendered (transparently) by the
          Jupyter notebook. Useful methods are :
  
          - 'resize' to resize the plot displayed in a Jupyter notebook
          - 'save_as_html' to save the plot to a file
          - 'open_in_browser' to save the plot and open it in a web browser.
  
      See Also
      --------
      nilearn.plotting.view_surf: plot from a surface map on a cortical mesh.
  
      """
      stat_map_img = check_niimg_3d(stat_map_img)
      info = _full_brain_info(
          volume_img=stat_map_img,
          mesh=surf_mesh,
          threshold=threshold,
          cmap=cmap,
          black_bg=black_bg,
          vmax=vmax,
          vmin=vmin,
          bg_on_data=bg_on_data,
          darkness=darkness,
          symmetric_cmap=symmetric_cmap,
          vol_to_surf_kwargs=vol_to_surf_kwargs,
      )
      info["colorbar"] = colorbar
      info["cbar_height"] = colorbar_height
      info["cbar_fontsize"] = colorbar_fontsize
      info["title"] = title
      info["title_fontsize"] = title_fontsize
      return _fill_html_template(info, embed_js=True)
  
imports: import collections.abc
  import json
  from warnings import warn
  import matplotlib
  import matplotlib.pyplot
  import numpy
  from nilearn import datasets, surface
  from nilearn._utils import fill_doc
  from nilearn._utils.niimg_conversions import check_niimg_3d
  from nilearn.plotting import cm
  from nilearn.plotting.html_document import HTMLDocument
  from nilearn.plotting.js_plotting_utils import add_js_lib, colorscale, get_html_template, mesh_to_plotly, to_color_strings
label_desc: Use image node_id 8 for calling a global function with example usage: view_img_on_surf(stat_map_img, surf_mesh, threshold, cmap, black_bg, vmax, vmin, symmetric_cmap, bg_on_data, darkness, colorbar, colorbar_height, colorbar_fontsize, title, title_fontsize, vol_to_surf_kwargs) and returns: _fill_html_template