code: def _prepare_lines_metadata(
      adjacency_matrix, coords, threshold, cmap, symmetric_cmap
  ):
      """Generate metadata related to lines for _connectome_view plot.
  
      Parameters
      ----------
      adjacency_matrix : ndarray, shape=(n_nodes, n_nodes)
          The weights of the edges.
  
      coords : ndarray, shape=(n_nodes, 3)
          The coordinates of the nodes in MNI space.
  
      threshold : str, number or None, optional
          If None, no thresholding.
          If it is a number only connections 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 connections of amplitude above the
          given percentile will be shown.
  
      cmap : str or matplotlib colormap, default=cm.bwr
          Colormap to use.
  
      symmetric_cmap : bool, default=True
          Make colormap symmetric (ranging from -vmax to vmax).
  
      Returns
      -------
      coordinates : dict
          Dictionary containing base64 values for each axis
      """
      lines_metadata = {}
  
      adjacency_matrix = np.nan_to_num(adjacency_matrix, copy=True)
      colors = colorscale(
          cmap,
          adjacency_matrix.ravel(),
          threshold=threshold,
          symmetric_cmap=symmetric_cmap,
      )
      lines_metadata["line_colorscale"] = colors["colors"]
      lines_metadata["line_cmin"] = float(colors["vmin"])
      lines_metadata["line_cmax"] = float(colors["vmax"])
      if threshold is not None:
          adjacency_matrix[
              np.abs(adjacency_matrix) <= colors["abs_threshold"]
          ] = 0
      s = sparse.coo_matrix(adjacency_matrix)
      nodes = np.asarray([s.row, s.col], dtype=int).T
      edges = np.arange(len(nodes))
      path_edges, path_nodes = _prepare_line(edges, nodes)
      lines_metadata["_con_w"] = encode(
          np.asarray(s.data, dtype="<f4")[path_edges]
      )
  
      line_coords = coords[path_nodes]
  
      lines_metadata = {
          **lines_metadata,
          **_encode_coordinates(line_coords, prefix="_con_"),
      }
  
      return lines_metadata
  
file_path: nilearn/nilearn/plotting/html_connectome.py
imports: import json
  import numpy
  from matplotlib import cm
  from scipy import sparse
  from nilearn.plotting.html_document import HTMLDocument
  from ..None import datasets
  from .None import cm
  from .js_plotting_utils import add_js_lib, colorscale, encode, get_html_template, mesh_to_plotly, to_color_strings
label_desc: Use image node_id 4 for calling a global function with example usage: _prepare_lines_metadata(adjacency_matrix, coords, threshold, cmap, symmetric_cmap) and returns: lines_metadata