class_docstr: Class to link multiple Brain objects.
code: def __init__(
      self,
      brains,
      time=True,
      camera=False,
      colorbar=True,
      picking=False,
  ):
      self.brains = brains
      self.leader = self.brains[0]  # select a brain as leader
  
      # check time infos
      times = [brain._times for brain in brains]
      if time and not all(np.allclose(x, times[0]) for x in times):
          warn("stc.times do not match, not linking time")
          time = False
  
      if camera:
          self.link_cameras()
  
      events_to_link = []
      if time:
          events_to_link.append("time_change")
      if colorbar:
          events_to_link.append("colormap_range")
  
      for brain in brains[1:]:
          link(self.leader, brain, include_events=events_to_link)
  
      if picking:
  
          def _func_add(*args, **kwargs):
              for brain in self.brains:
                  brain._add_vertex_glyph2(*args, **kwargs)
                  brain.plotter.update()
  
          def _func_remove(*args, **kwargs):
              for brain in self.brains:
                  brain._remove_vertex_glyph2(*args, **kwargs)
  
          # save initial picked points
          initial_points = dict()
          for hemi in ("lh", "rh"):
              initial_points[hemi] = set()
              for brain in self.brains:
                  initial_points[hemi] |= set(brain.picked_points[hemi])
  
          # link the viewers
          for brain in self.brains:
              brain.clear_glyphs()
              brain._add_vertex_glyph2 = brain._add_vertex_glyph
              brain._add_vertex_glyph = _func_add
              brain._remove_vertex_glyph2 = brain._remove_vertex_glyph
              brain._remove_vertex_glyph = _func_remove
  
          # link the initial points
          for hemi in initial_points.keys():
              if hemi in brain._layered_meshes:
                  mesh = brain._layered_meshes[hemi]._polydata
                  for vertex_id in initial_points[hemi]:
                      self.leader._add_vertex_glyph(
                          hemi, mesh, vertex_id
                      )
  
file_path: mne-python/mne/viz/_brain/_linkviewer.py
imports: import numpy
  from ...utils import warn
  from ..ui_events import link
label_desc: Use image node_id 1 to create a new _LinkViewer object  with example: obj = _LinkViewer(brains, time, camera, colorbar, picking)