code: def region_localization_error(
      stc_true, stc_est, src, threshold="90%", per_sample=True
  ):
      r"""Compute region localization error (RLE) between 2 source estimates.
  
      .. math::
  
          RLE = \frac{1}{2Q}\sum_{k \in I} \min_{l \in \hat{I}}{||r_k - r_l||} + \frac{1}{2\hat{Q}}\sum_{l \in \hat{I}} \min_{k \in I}{||r_k - r_l||}
  
      where :math:`I` and :math:`\hat{I}` denote respectively the original and
      estimated indexes of active sources, :math:`Q` and :math:`\hat{Q}` are
      the numbers of original and estimated active sources.
      :math:`r_k` denotes the position of the k-th source dipole in space
      and :math:`||\cdot||` is an Euclidean norm in :math:`\mathbb{R}^3`.
  
      Parameters
      ----------
      %(stc_true_metric)s
      %(stc_est_metric)s
      src : instance of SourceSpaces
          The source space on which the source estimates are defined.
      threshold : float | str
          The threshold to apply to source estimates before computing
          the dipole localization error. If a string the threshold is
          a percentage and it should end with the percent character.
      %(per_sample_metric)s
  
      Returns
      -------
      %(stc_metric)s
  
      Notes
      -----
      Papers :footcite:`MaksymenkoEtAl2017` and :footcite:`BeckerEtAl2017`
      use term Dipole Localization Error (DLE) for the same formula. Paper
      :footcite:`YaoEtAl2005` uses term Error Distance (ED) for the same formula.
      To unify the terminology and to avoid confusion with other cases
      of using term DLE but for different metric :footcite:`MolinsEtAl2008`, we
      use term Region Localization Error (RLE).
  
      .. versionadded:: 1.2
  
      References
      ----------
      .. footbibliography::
      """  # noqa: E501
      stc_true, stc_est = _uniform_stc(stc_true, stc_est)
      stc_true, stc_est = _thresholding(stc_true, stc_est, threshold)
      func = partial(_dle, src=src, stc=stc_true)
      metric = _apply(func, stc_true, stc_est, per_sample=per_sample)
      return metric
  
imports: from functools import partial
  import numpy
  from scipy.spatial.distance import cdist
  from ...utils import _check_option, _validate_type, fill_doc
label_desc: Use image node_id 11 for calling a global function with example usage: region_localization_error(stc_true, stc_est, src, threshold, per_sample) and returns: metric