class_docstr: Descriptor of a certain domain that consists of discrete elements that
  are characterized by a coordinate system and a topology:
  the coordinate system is specified through a coordinate array
  the topology encodes the neighboring system
class_docstr_tok: ["Descriptor","of","a","certain","domain","that","consists","of","discrete","elements","that","are","characterized","by","a","coordinate","system","and","a","topology",":","the","coordinate","system","is","specified","through","a","coordinate","array","the","topology","encodes","the","neighboring","system"]
docstr: Initialize discrete domain instance
  
  Parameters
  ----------
  dim: int
      the (physical) dimension of the domain.
  coord: array of shape(size, em_dim)
      explicit coordinates of the domain sites.
  local_volume: array of shape(size)
      yields the volume associated with each site.
  id: string, optional
      domain identifier.
  referential: string, optional
      identifier of the referential of the coordinates system.
  
  Notes
  -----
  Caveat: em_dim may be greater than dim e.g. (meshes coordinate in 3D)
code: def __init__(self, dim, coord, local_volume, id="", referential=""):
      """Initialize discrete domain instance
  
      Parameters
      ----------
      dim: int
          the (physical) dimension of the domain.
      coord: array of shape(size, em_dim)
          explicit coordinates of the domain sites.
      local_volume: array of shape(size)
          yields the volume associated with each site.
      id: string, optional
          domain identifier.
      referential: string, optional
          identifier of the referential of the coordinates system.
  
      Notes
      -----
      Caveat: em_dim may be greater than dim e.g. (meshes coordinate in 3D)
      """
      # dimension
      self.dim = dim
  
      # number of discrete elements
      self.size = coord.shape[0]
  
      # coordinate system
      if np.size(coord) == coord.shape[0]:
          coord = np.reshape(coord, (np.size(coord), 1))
  
      if np.size(coord) == 0:
          self.em_dim = dim
      else:
          self.em_dim = coord.shape[1]
  
      if self.em_dim < dim:
          raise ValueError(
              "Embedding dimension cannot be smaller than dim"
          )
      self.coord = coord
  
      # volume
      if np.size(local_volume) != self.size:
          raise ValueError("Inconsistent Volume size")
      if (local_volume < 0).any():
          raise ValueError("Volume should be positive")
  
      self.local_volume = np.ravel(local_volume)
      self.id = id
      self.referential = referential
      self.features = {}
  
imports: import numpy
  import scipy.sparse
  from nibabel import Nifti1Image, load, save
  from nipy.algorithms.graph import WeightedGraph, wgraph_from_3d_grid, wgraph_from_coo_matrix
  from nipy.io.nibcompat import get_affine, get_header
label_desc: Use image node_id 1 to create a new DiscreteDomain object  with example: obj = DiscreteDomain(dim, coord, local_volume, id, referential)