code: def ward_field_segment(F, stop=-1, qmax=-1, verbose=False):
      """Agglomerative function based on a field structure
  
      Parameters
      ----------
      F the input field (graph+feature)
      stop: float, optional
          the stopping crterion.  if stop==-1, then no stopping criterion is used
      qmax: int, optional
          the maximum number of desired clusters (in the limit of the stopping
          criterion)
      verbose : bool, optional
          If True, print diagnostic information
  
      Returns
      -------
      u: array of shape (F.V)
         labelling of the graph vertices according to the criterion
      cost array of shape (F.V - 1)
           the cost of each merge step during the clustering procedure
  
  
      Notes
      -----
      See ward_quick_segment for more information
  
      Caveat : only approximate
      """
      u, cost = ward_quick_segment(F, F.field, stop, qmax, verbose)
      return u, cost
  
imports: from warnings import warn
  import numpy
  from ..graph.forest import Forest
  from ..graph.graph import WeightedGraph
label_desc: Use image node_id 10 for calling a global function with example usage: ward_field_segment(F, stop, qmax, verbose) and returns: u,  cost