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: Append or modify a ROI feature
  
  Parameters
  ----------
  fid: str,
    feature identifier
  data: list of self.k features or a single feature
    The ROI feature data
  id: any hashable type
    Id of the ROI of which we want to set the ROI feature.
    Can be None (default) if we want to set all ROIs's ROI features.
  override: bool, optional,
            Allow feature overriding
  
  Note that we cannot create a ROI feature having the same name than
  a feature.
  Note that the `id` feature cannot be modified as an internal
  component.
docstr_tok: ["Append","or","modify","a","ROI","feature","Parameters","--","--","--","--","--","fid",":","str",",","feature","identifier","data",":","list","of","self.k","features","or","a","single","feature","The","ROI","feature","data","id",":","any","hashable","type","Id","of","the","ROI","of","which","we","want","to","set","the","ROI","feature",".","Can","be","None","(","default",")","if","we","want","to","set","all","ROIs","'s","ROI","features",".","override",":","bool",",","optional",",","Allow","feature","overriding","Note","that","we","can","not","create","a","ROI","feature","having","the","same","name","than","a","feature",".","Note","that","the","`","id","`","feature","can","not","be","modified","as","an","internal","component","."]
code: def set_roi_feature(self, fid, data, id=None, override=False):
      """Append or modify a ROI feature
  
      Parameters
      ----------
      fid: str,
        feature identifier
      data: list of self.k features or a single feature
        The ROI feature data
      id: any hashable type
        Id of the ROI of which we want to set the ROI feature.
        Can be None (default) if we want to set all ROIs's ROI features.
      override: bool, optional,
                Allow feature overriding
  
      Note that we cannot create a ROI feature having the same name than
      a feature.
      Note that the `id` feature cannot be modified as an internal
      component.
  
      """
      # check we do not modify the `id` feature
      if "id" in self.roi_features and fid == "id":
          return
      # check we will not override anything
      if fid in self.roi_features and not override:
          # TODO: raise a warning
          return
      # check the feature is already present if setting a single roi
      if fid not in self.roi_features and len(data) != self.k:
          raise ValueError(
              "`%s` feature does not exist, create it first"
          )
      if fid in self.features:
          raise ValueError(f"a feature called `{fid}` already exists")
  
      # modify one particular region
      if id is not None:
          # check data size
          if len(data) != 1:
              raise ValueError(
                  "data for region `%i` should have length 1"
              )
          # update feature
          the_feature = self.get_roi_feature(fid)
          the_feature[self.select_id(id)] = data
      else:
          # check data size
          if len(data) != self.k:
              raise ValueError("data should have length %i" % self.k)
          self.roi_features.update({fid: data})
  
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 19 for calling the SubDomains obj's underlying member method code with example usage: obj.set_roi_feature(fid, data, id, override) without return types