code: def _get_faces_on_edge(faces, parc_idx):
      """Identify which faces lie on the outeredge of the parcellation \
      defined by the indices in parc_idx.
  
      Parameters
      ----------
      faces : numpy.ndarray of shape (n, 3), indices of the mesh faces
  
      parc_idx : numpy.ndarray, indices of the vertices
          of the region to be plotted
  
      """
      # count how many vertices belong to the given parcellation in each face
      verts_per_face = np.isin(faces, parc_idx).sum(axis=1)
  
      # test if parcellation forms regions
      if np.all(verts_per_face < 2):
          raise ValueError(
              "Vertices in parcellation do not form region."
          )
  
      vertices_on_edge = np.intersect1d(
          np.unique(faces[verts_per_face == 2]), parc_idx
      )
      faces_outside_edge = np.isin(faces, vertices_on_edge).sum(axis=1)
  
      return np.logical_and(faces_outside_edge > 0, verts_per_face < 3)
  
imports: import itertools
  import math
  from collections.abc import Sequence
  from warnings import warn
  import matplotlib
  import matplotlib.pyplot
  import numpy
  from matplotlib import gridspec
  from matplotlib.cm import ScalarMappable
  from matplotlib.colorbar import make_axes
  from matplotlib.colors import LinearSegmentedColormap, Normalize, to_rgba
  from matplotlib.patches import Patch
  from mpl_toolkits.mplot3d.art3d import Poly3DCollection
  from nilearn import image, surface
  from nilearn._utils import check_niimg_3d, compare_version, fill_doc
  from nilearn._utils.helpers import is_kaleido_installed, is_plotly_installed
  from nilearn.plotting.cm import cold_hot, mix_colormaps
  from nilearn.plotting.displays._slicers import _get_cbar_ticks
  from nilearn.plotting.html_surface import get_vertexcolor
  from nilearn.plotting.img_plotting import get_colorbar_and_data_ranges
  from nilearn.plotting.js_plotting_utils import colorscale
  from nilearn.surface import load_surf_data, load_surf_mesh, vol_to_surf
  from nilearn.surface.surface import check_mesh
label_desc: Use image node_id 19 for calling a global function with example usage: _get_faces_on_edge(faces, parc_idx) and returns: np