docs: def dice_coeff_multiclass(im1, im2, roi2ind):
      ''' Calculate Dice score for parcellation images <im1> and <im2> and ROI value <val>.
          Input images can be given as:
              1. paths to NIfTI image files or as
              2. Numpy arrays.
          The ROI value must be given as a dictionary of lists of indexes for each ROI
          Outputs a float number representing the Dice score.
      '''
  
      if isinstance(im1, basestring) and isinstance(im2, basestring) \
      and os.path.isfile(im1) and os.path.basename(im1).endswith(('nii', 'nii.gz')) \
      and os.path.isfile(im2) and os.path.basename(im2).endswith(('nii', 'nii.gz')):
          imn1 = imio.getnii(im1, output='image')
          imn2 = imio.getnii(im2, output='image')
      elif isinstance(im1, (np.ndarray, np.generic)) and isinstance(im1, (np.ndarray, np.generic)):
          imn1 = im1
          imn2 = im2
      else:
          raise TypeError('Unrecognised or Mismatched Images.')
  
      if imn1.shape != imn2.shape:
          raise ValueError('Shape Mismatch: Input images must have the same shape.')
  
      out = {}
      for k in roi2ind.keys():
  
      	# multiple values in list corresponding to a composite ROI
          imv1 = (imn1==roi2ind[k][0])
          imv2 = (imn2==roi2ind[k][0])
          for v in roi2ind[k][1:]:
              # boolean addition to form a composite ROI
              imv1 += (imn1==v)
              imv2 += (imn2==v)
  
  	    #-compute Dice coefficient
      	intrsctn = np.logical_and(imv1, imv2)
      	out[k] = 2. * intrsctn.sum() / (imv1.sum() + imv2.sum())
  
      return out