code: def subdomain_from_image(mim, nn=18):
      """Return a SubDomain instance from the input mask image.
  
      Parameters
      ----------
      mim: NiftiIImage instance, or string path toward such an image
        supposedly a label image
      nn: int, optional
        Neighboring system considered from the image can be 6, 18 or 26.
  
      Returns
      -------
      The MultipleROI instance
  
      Notes
      -----
      Only labels > -1 are considered
  
      """
      if isinstance(mim, str):
          iim = load(mim)
      else:
          iim = mim
  
      return subdomain_from_array(iim.get_fdata(), get_affine(iim), nn)
  
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 2 for calling a global function with example usage: subdomain_from_image(mim, nn) and returns: subdomain_from_array