class_docstr: This is a class to represent multiple ROI objects, where the
  reference to a given domain is explicit.
  
  A multiple ROI object is a set of ROI defined on a given domain,
  each having its own 'region-level' characteristics (ROI features).
  
  Every voxel of the domain can have its own characteristics yet,
  defined at the 'voxel-level', but those features can only be accessed
  familywise (i.e. the values are grouped by ROI).
  
  Parameters
  ----------
  k : int
    Number of ROI in the SubDomains object
  label : array of shape (domain.size), dtype=np.int_
    An array use to define which voxel belongs to which ROI.
    The label values greater than -1 correspond to subregions
    labelling. The labels are recomputed so as to be consecutive
    integers.
    The labels should not be accessed outside this class. One has to
    use the API mapping methods instead.
  features : dict {str: list of object, length=self.k}
    Describe the voxels features, grouped by ROI
  roi_features : dict {str: array-like, shape=(self.k, roi_feature_dim)
    Describe the ROI features. A special feature, `id`, is read-only and
    is used to give an unique identifier for region, which is persistent
    through the MROI objects manipulations. On should access the different
    ROI's features using ids.
class_docstr_tok: ["This","is","a","class","to","represent","multiple","ROI","objects",",","where","the","reference","to","a","given","domain","is","explicit",".","A","multiple","ROI","object","is","a","set","of","ROI","defined","on","a","given","domain",",","each","having","its","own","'region-level","'","characteristics","(","ROI","features",")",".","Every","voxel","of","the","domain","can","have","its","own","characteristics","yet",",","defined","at","the","'voxel-level","'",",","but","those","features","can","only","be","accessed","familywise","(","i.e",".","the","values","are","grouped","by","ROI",")",".","Parameters","--","--","--","--","--","k",":","int","Number","of","ROI","in","the","SubDomains","object","label",":","array","of","shape","(","domain.size",")",",","dtype=np.int_","An","array","use","to","define","which","voxel","belongs","to","which","ROI",".","The","label","values","greater","than","-1","correspond","to","subregions","labelling",".","The","labels","are","recomputed","so","as","to","be","consecutive","integers",".","The","labels","should","not","be","accessed","outside","this","class",".","One","has","to","use","the","API","mapping","methods","instead",".","features",":","dict","{","str",":","list","of","object",",","length=self.k","}","Describe","the","voxels","features",",","grouped","by","ROI","roi_features",":","dict","{","str",":","array-like",",","shape=","(","self.k",",","roi_feature_dim",")","Describe","the","ROI","features",".","A","special","feature",",","`","id","`",",","is","read-only","and","is","used","to","give","an","unique","identifier","for","region",",","which","is","persistent","through","the","MROI","objects","manipulations",".","On","should","access","the","different","ROI","'s","features","using","ids","."]
docstr: Compute a ROI representative of a given feature.
  
  Parameters
  ----------
  fid : str
    Feature id
  method : str, optional
    Method used to compute a representative.
    Chosen among 'mean' (default), 'max', 'median', 'min',
    'weighted mean'.
  id : any hashable type, optional
    Id of the ROI from which we want to extract a representative feature.
    Can be None (default) if we want to get all ROIs's representatives.
  assess_quality: bool, optional
    If True, a new roi feature is created, which represent the quality of
    the feature representative (the number of non-nan value for the
    feature over the ROI size).  Default is False.
  
  Returns
  -------
  summary_feature: np.ndarray, shape=(self.k, feature_dim)
    Representative feature computed according to `method`.
docstr_tok: ["Compute","a","ROI","representative","of","a","given","feature",".","Parameters","--","--","--","--","--","fid",":","str","Feature","id","method",":","str",",","optional","Method","used","to","compute","a","representative",".","Chosen","among","'mean","'","(","default",")",",","'max","'",",","'median","'",",","'min","'",",","'weighted","mean","'",".","id",":","any","hashable","type",",","optional","Id","of","the","ROI","from","which","we","want","to","extract","a","representative","feature",".","Can","be","None","(","default",")","if","we","want","to","get","all","ROIs","'s","representatives",".","assess_quality",":","bool",",","optional","If","True",",","a","new","roi","feature","is","created",",","which","represent","the","quality","of","the","feature","representative","(","the","number","of","non-nan","value","for","the","feature","over","the","ROI","size",")",".","Default","is","False",".","Returns","--","--","--","-","summary_feature",":","np.ndarray",",","shape=","(","self.k",",","feature_dim",")","Representative","feature","computed","according","to","`","method","`","."]
code: def representative_feature(
      self, fid, method="mean", id=None, assess_quality=False
  ):
      """Compute a ROI representative of a given feature.
  
      Parameters
      ----------
      fid : str
        Feature id
      method : str, optional
        Method used to compute a representative.
        Chosen among 'mean' (default), 'max', 'median', 'min',
        'weighted mean'.
      id : any hashable type, optional
        Id of the ROI from which we want to extract a representative feature.
        Can be None (default) if we want to get all ROIs's representatives.
      assess_quality: bool, optional
        If True, a new roi feature is created, which represent the quality of
        the feature representative (the number of non-nan value for the
        feature over the ROI size).  Default is False.
  
      Returns
      -------
      summary_feature: np.ndarray, shape=(self.k, feature_dim)
        Representative feature computed according to `method`.
      """
      rf = []
      eps = 1.0e-15
      feature_quality = np.zeros(self.k)
      for i, k in enumerate(self.get_id()):
          f = self.get_feature(fid, k)
          # NaN-resistant representative
          if f.ndim == 2:
              nan = np.isnan(f.sum(1))
          else:
              nan = np.isnan(f)
          # feature quality
          feature_quality[i] = (~nan).sum() / float(nan.size)
          # compute representative
          if method == "mean":
              rf.append(np.mean(f[~nan], 0))
          if method == "weighted mean":
              lvk = self.get_local_volume(k)[~nan]
              tmp = np.dot(lvk, f[~nan].reshape((-1, 1))) / np.maximum(
                  eps, np.sum(lvk)
              )
              rf.append(tmp)
          if method == "min":
              rf.append(np.min(f[~nan]))
          if method == "max":
              rf.append(np.max(f[~nan]))
          if method == "median":
              rf.append(np.median(f[~nan], 0))
      if id is not None:
          summary_feature = rf[self.select_id(id)]
      else:
          summary_feature = rf
  
      if assess_quality:
          self.set_roi_feature(f"{fid}_quality", feature_quality)
      return np.array(summary_feature)
  
imports: import numpy
  from nibabel import Nifti1Image, load
  from nipy.io.nibcompat import get_affine, get_header
  from .None import discrete_domain
label_desc: Use image node_id 13 for calling the SubDomains obj's underlying member method code with example usage: obj.representative_feature(fid, method, id, assess_quality) and returns: np