class_docstr: This is the basic field structure,
       which contains the weighted graph structure
       plus an array of data (the 'field')
  field is an array of size(n, p)
        where n is the number of vertices of the graph
        and p is the field dimension
class_docstr_tok: ["This","is","the","basic","field","structure",",","which","contains","the","weighted","graph","structure","plus","an","array","of","data","(","the","'field","'",")","field","is","an","array","of","size","(","n",",","p",")","where","n","is","the","number","of","vertices","of","the","graph","and","p","is","the","field","dimension"]
docstr: customized watershed analysis of the field.
  Note that bassins are found around each maximum
  (and not minimum as conventionally)
  
  Parameters
  ----------
  refdim: int, optional
  th: float optional, threshold of the field
  
  Returns
  -------
  idx: array of shape (nbassins)
       indices of the vertices that are local maxima
  label : array of shape (self.V)
        labelling of the vertices according to their bassin
docstr_tok: ["customized","watershed","analysis","of","the","field",".","Note","that","bassins","are","found","around","each","maximum","(","and","not","minimum","as","conventionally",")","Parameters","--","--","--","--","--","refdim",":","int",",","optional","th",":","float","optional",",","threshold","of","the","field","Returns","--","--","--","-","idx",":","array","of","shape","(","nbassins",")","indices","of","the","vertices","that","are","local","maxima","label",":","array","of","shape","(","self.V",")","labelling","of","the","vertices","according","to","their","bassin"]
code: def custom_watershed(self, refdim=0, th=NEGINF):
      """customized watershed analysis of the field.
      Note that bassins are found around each maximum
      (and not minimum as conventionally)
  
      Parameters
      ----------
      refdim: int, optional
      th: float optional, threshold of the field
  
      Returns
      -------
      idx: array of shape (nbassins)
           indices of the vertices that are local maxima
      label : array of shape (self.V)
            labelling of the vertices according to their bassin
      """
      from numpy import ma
  
      if np.size(self.field) == 0:
          raise ValueError("No field has been defined so far")
      if self.field.shape[1] - 1 < refdim:
          raise ValueError("refdim>field.shape[1]")
  
      label = -np.ones(self.V, np.int_)
  
      # create a subfield(thresholding)
      sf = self.subfield(self.field[:, refdim] >= th)
  
      # compute the basins
      hneighb = sf.highest_neighbor()
      edges = np.vstack((hneighb, np.arange(sf.V))).T
      edges = np.vstack(
          (edges, np.vstack((np.arange(sf.V), hneighb)).T)
      )
      aux = Graph(sf.V, edges.shape[0], edges)
      llabel = aux.cc()
      n_bassins = len(np.unique(llabel))
  
      # write all the depth values
      label[self.field[:, refdim] >= th] = llabel
      idx = np.array(
          [
              ma.array(
                  self.field[:, refdim], mask=(label != c)
              ).argmax()
              for c in range(n_bassins)
          ]
      )
      return idx, label
  
imports: from warnings import warn
  import numpy
  from .graph import Graph, WeightedGraph
label_desc: Use image node_id 12 for calling the Field obj's underlying member method code with example usage: obj.custom_watershed(refdim, th) and returns: idx,  label