docs: def create_mask(
          fnii,
          fimout = '',
          outpath = '',
          fill = 1,
          dtype_fill = np.uint8,
          
          thrsh = 0.,
          fwhm = 0.,):
  
      ''' create mask over the whole image or over the threshold area'''
      
  
      #> output path
      if outpath=='' and fimout!='':
          opth = os.path.dirname(fimout)
          if opth=='':
              opth = os.path.dirname(fnii)
              fimout = os.path.join(opth, fimout)
  
      elif outpath=='':
          opth = os.path.dirname(fnii)
  
      else:
          opth = outpath
  
      #> output file name if not given
      if fimout=='':
          fniis = os.path.split(fnii)
          fimout = os.path.join(opth, fniis[1].split('.nii')[0]+'_mask.nii.gz')
  
      niidct = imio.getnii(fnii, output='all')
      im = niidct['im']
      hdr = niidct['hdr']
  
      if im.ndim>3:
          raise ValueError('The masking function only accepts 3-D images.')
  
      #> generate output image
      if thrsh>0.:
          smoim = ndi.filters.gaussian_filter(
                      im,
                      imio.fwhm2sig(fwhm, voxsize=abs(hdr['pixdim'][1])), 
                      mode='mirror')
          thrsh = thrsh*smoim.max()
          immsk = np.int8(smoim>thrsh)
          immsk = imfill(immsk)
  
          #> output image
          imo = fill * immsk.astype(dtype_fill)
  
      else:
  
          imo = fill * np.ones(im.shape, dtype = dtype_fill)
  
      #> save output image
      imio.array2nii( 
                  imo,
                  niidct['affine'],
                  fimout,
                  trnsp = (niidct['transpose'].index(0),
                           niidct['transpose'].index(1),
                           niidct['transpose'].index(2)),
                  flip = niidct['flip'])
  
      return {'fim':fimout, 'im':imo}