class_docstr: Class that handles hierarchical ROIs
  
  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.
  parents : np.ndarray, shape(self.k)
    self.parents[i] is the index of the parent of the i-th ROI.
  
  TODO: have the parents as a list of id rather than a list of indices.
class_docstr_tok: ["Class","that","handles","hierarchical","ROIs","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",".","parents",":","np.ndarray",",","shape","(","self.k",")","self.parents","[","i","]","is","the","index","of","the","parent","of","the","i-th","ROI",".","TODO",":","have","the","parents","as","a","list","of","id","rather","than","a","list","of","indices","."]
docstr: Get ROI volume
  
  Parameters
  ----------
  id: any hashable type, optional
    Id of the ROI from which we want to get the volume.
    Can be None (default) if we want all ROIs's volumes.
  ignore_children : bool, optional
    Specify if the volume of the node should include
    (ignore_children = False) or not the one of its children
    (ignore_children = True).
  
  Returns
  -------
  volume : float
    if an id is provided,
       or list of float
    if no id provided (default)
docstr_tok: ["Get","ROI","volume","Parameters","--","--","--","--","--","id",":","any","hashable","type",",","optional","Id","of","the","ROI","from","which","we","want","to","get","the","volume",".","Can","be","None","(","default",")","if","we","want","all","ROIs","'s","volumes",".","ignore_children",":","bool",",","optional","Specify","if","the","volume","of","the","node","should","include","(","ignore_children","=","False",")","or","not","the","one","of","its","children","(","ignore_children","=","True",")",".","Returns","--","--","--","-","volume",":","float","if","an","id","is","provided",",","or","list","of","float","if","no","id","provided","(","default",")"]
code: def get_volume(self, id=None, ignore_children=True):
      """Get ROI volume
  
      Parameters
      ----------
      id: any hashable type, optional
        Id of the ROI from which we want to get the volume.
        Can be None (default) if we want all ROIs's volumes.
      ignore_children : bool, optional
        Specify if the volume of the node should include
        (ignore_children = False) or not the one of its children
        (ignore_children = True).
  
      Returns
      -------
      volume : float
        if an id is provided,
           or list of float
        if no id provided (default)
      """
      if ignore_children:
          # volume of the children is not included
          volume = SubDomains.get_volume(self, id)
      else:
          # volume of the children is included
          if id is not None:
              volume = SubDomains.get_volume(self, id)
              desc = self.make_forest().get_descendants(
                  self.select_id(id), exclude_self=True
              )
              # get children volume
              for k in desc:
                  volume = volume + SubDomains.get_volume(
                      self, self.get_id()[k]
                  )
          else:
              volume = []
              for id in self.get_id():
                  roi_volume = SubDomains.get_volume(self, id)
                  desc = self.make_forest().get_descendants(
                      self.select_id(id), exclude_self=True
                  )
                  # get children volume
                  for k in desc:
                      roi_volume = roi_volume + SubDomains.get_volume(
                          self, self.get_id()[k]
                      )
                  volume.append(roi_volume)
      return volume
  
imports: import numpy
  from nipy.algorithms.graph.field import field_from_coo_matrix_and_data
  from nipy.algorithms.graph.forest import Forest
  from nipy.algorithms.graph.graph import WeightedGraph
  from .mroi import SubDomains
label_desc: Use image node_id 2 for calling the HierarchicalROI obj's underlying member method code with example usage: obj.get_volume(id, ignore_children) and returns: volume