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: Returns an DiscreteDomain instance that has been further masked
          
code: def mask(self, bmask, id=""):
      """Returns an DiscreteDomain instance that has been further masked"""
      if bmask.size != self.size:
          raise ValueError("Invalid mask size")
  
      svol = self.local_volume[bmask]
      scoord = self.coord[bmask]
      DD = DiscreteDomain(self.dim, scoord, svol, id, self.referential)
  
      for fid in list(self.features.keys()):
          f = self.features.pop(fid)
          DD.set_feature(fid, f[bmask])
      return DD
  
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 6 for calling the DiscreteDomain obj's underlying member method code with example usage: obj.mask(bmask, id) and returns: DD