code: def obj_tpr(result, reference, connectivity=1):
      """
      The true positive rate of distinct binary object detection.
  
      The true positive rates gives a percentage measure of how many distinct binary
      objects in the first array also exists in the second array. A partial overlap
      (of minimum one voxel) is here considered sufficient.
  
      In cases where two distinct binary object in the first array overlaps with a single
      distinct object in the second array, only one is considered to have been detected
      successfully.
  
      Parameters
      ----------
      result : array_like
          Input data containing objects. Can be any type but will be converted
          into binary: background where 0, object everywhere else.
      reference : array_like
          Input data containing objects. Can be any type but will be converted
          into binary: background where 0, object everywhere else.
      connectivity : int
          The neighbourhood/connectivity considered when determining what accounts
          for a distinct binary object. This value is passed to
          `scipy.ndimage.generate_binary_structure` and should usually be :math:`> 1`.
          The decision on the connectivity is important, as it can influence the results
          strongly. If in doubt, leave it as it is.
  
      Returns
      -------
      tpr : float
          A percentage measure of how many distinct binary objects in ``result`` also exists
          in ``reference``. It has the range :math:`[0, 1]`, where a :math:`1` denotes an ideal score.
  
      Raises
      ------
      RuntimeError
          If the reference object is empty.
  
      See also
      --------
      :func:`obj_fpr`
  
      Notes
      -----
      This is not a real metric, as it is directed. Whatever array is considered as
      reference should be passed second. A perfect score of :math:`1` tells that all distinct
      binary objects in the reference array also exist in the result array, but does not
      reveal anything about additional binary objects in the result array
      (use :func:`obj_fpr` for this).
  
      Examples
      --------
      >>> arr2 = numpy.asarray([[1,0,0],[1,0,1],[0,0,1]])
      >>> arr1 = numpy.asarray([[0,0,1],[1,0,1],[0,0,1]])
      >>> arr2
      array([[1, 0, 0],
             [1, 0, 1],
             [0, 0, 1]])
      >>> arr1
      array([[0, 0, 1],
             [1, 0, 1],
             [0, 0, 1]])
      >>> obj_tpr(arr1, arr2)
      1.0
      >>> obj_tpr(arr2, arr1)
      1.0
  
      Example of directedness:
  
      >>> arr2 = numpy.asarray([1,0,1,0,1])
      >>> arr1 = numpy.asarray([1,0,1,0,0])
      >>> obj_tpr(arr1, arr2)
      0.6666666666666666
      >>> obj_tpr(arr2, arr1)
      1.0
  
      Examples of multiple overlap treatment:
  
      >>> arr2 = numpy.asarray([1,0,1,0,1,1,1])
      >>> arr1 = numpy.asarray([1,1,1,0,1,0,1])
      >>> obj_tpr(arr1, arr2)
      0.6666666666666666
      >>> obj_tpr(arr2, arr1)
      0.6666666666666666
  
      >>> arr2 = numpy.asarray([1,0,1,1,1,0,1])
      >>> arr1 = numpy.asarray([1,1,1,0,1,1,1])
      >>> obj_tpr(arr1, arr2)
      0.6666666666666666
      >>> obj_tpr(arr2, arr1)
      1.0
  
      >>> arr2 = numpy.asarray([[1,0,1,0,0],
                                [1,0,0,0,0],
                                [1,0,1,1,1],
                                [0,0,0,0,0],
                                [1,0,1,0,0]])
      >>> arr1 = numpy.asarray([[1,1,1,0,0],
                                [0,0,0,0,0],
                                [1,1,1,0,1],
                                [0,0,0,0,0],
                                [1,1,1,0,0]])
      >>> obj_tpr(arr1, arr2)
      0.8
      >>> obj_tpr(arr2, arr1)
      1.0
      """
      (
          _,
          _,
          n_obj_result,
          _,
          mapping,
      ) = __distinct_binary_object_correspondences(
          reference, result, connectivity
      )
      return len(mapping) / float(n_obj_result)
  
imports: import numpy
  from scipy.ndimage import _ni_support
  from scipy.ndimage import distance_transform_edt, binary_erosion, generate_binary_structure
  from scipy.ndimage import label, find_objects
  from scipy.stats import pearsonr
label_desc: Use image node_id 20 for calling a global function with example usage: obj_tpr(result, reference, connectivity) and returns: unknown