code: def precision(result, reference):
      """
      Precison.
  
      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.
  
      Returns
      -------
      precision : float
          The precision between two binary datasets, here mostly binary objects in images,
          which is defined as the fraction of retrieved instances that are relevant. The
          precision is not symmetric.
  
      See also
      --------
      :func:`recall`
  
      Notes
      -----
      Not symmetric. The inverse of the precision is :func:`recall`.
      High precision means that an algorithm returned substantially more relevant results than irrelevant.
  
      References
      ----------
      .. [1] http://en.wikipedia.org/wiki/Precision_and_recall
      .. [2] http://en.wikipedia.org/wiki/Confusion_matrix#Table_of_confusion
      """
      result = numpy.atleast_1d(result.astype(numpy.bool_))
      reference = numpy.atleast_1d(reference.astype(numpy.bool_))
  
      tp = numpy.count_nonzero(result & reference)
      fp = numpy.count_nonzero(result & ~reference)
  
      try:
          precision = tp / float(tp + fp)
      except ZeroDivisionError:
          precision = 0.0
  
      return precision
  
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 3 for calling a global function with example usage: precision(result, reference) and returns: precision