docs: def resample_vinci(
          fref,
          fflo,
          faff,
          intrp = 0,
          fimout = '',
          fcomment = '',
          outpath = '',
          pickname = 'ref',
          vc = '',
          con = '',
          vincipy_path = '',
          atlas_resample = False,
          atlas_ref_make = False,
          atlas_ref_del = False,
          close_vinci = False,
          close_buff = True,
          ):
      ''' Resample the floating image <fflo> into the geometry of <fref>,
          using the Vinci transformation output <faff> (an *.xml file).
          Output the NIfTI file path of the resampled/resliced image.
      '''
  
      #---------------------------------------------------------------------------
      #> output path
      if outpath=='' and fimout!='' and '/' in fimout:
          opth = os.path.dirname(fimout)
          if opth=='':
              opth = os.path.dirname(fflo)
          fimout = os.path.basename(fimout)
  
      elif outpath=='':
          opth = os.path.dirname(fflo)
      else:
          opth = outpath
      imio.create_dir(opth)
  
      #> output floating and affine file names
      if fimout=='':
          if pickname=='ref':
              fout = os.path.join(
                      opth,
                      'affine-ref-' \
                      +os.path.basename(fref).split('.nii')[0]+fcomment+'.nii.gz')
          else:
              fout = os.path.join(
                      opth,
                      'affine-flo-' \
                      +os.path.basename(fflo).split('.nii')[0]+fcomment+'.nii.gz')
      else:
          fout = os.path.join(
                  opth,
                  fimout.split('.')[0]+'.nii.gz')
      #---------------------------------------------------------------------------
  
  
      if vincipy_path=='':
          try:
              import resources
              vincipy_path = resources.VINCIPATH
          except:
              raise NameError('e> could not import resources \
                      or find variable VINCIPATH in resources.py')
  
      sys.path.append(vincipy_path)
  
      try:
          from VinciPy import Vinci_Bin, Vinci_Connect, Vinci_Core, Vinci_XML, Vinci_ImageT
      except ImportError:
          raise ImportError('e> could not import Vinci:\n \
                  check the variable VINCIPATH (path to Vinci) in resources.py')
  
  
      #---------------------------------------------------------------------------
      #> start Vinci core engine if it is not running/given
      if vc=='' or con=='':
          #> adopted from the Vinci's example RunMMMJob.py
          bin = Vinci_Bin.Vinci_Bin()
          con = Vinci_Connect.Vinci_Connect(bin)
          vinci_binpath = con.StartMyVinci()
  
          vc = Vinci_Core.Vinci_CoreCalc(con)
          vc.StdProject()
      #---------------------------------------------------------------------------
  
      if int(intrp)==0:
          interp_nn = True
      else:
          interp_nn = False
  
      #---------------------------------------------------------------------------
      #> change the reference image to be loaded as atlas
      if atlas_resample and atlas_ref_make:
  
          #> output file name for the extra reference image
          fextref = os.path.join(opth, 'reference-as-atlas.nii.gz')
  
          prc.nii_modify(fref, fimout=fextref, voxel_range=[0., 255.])
          
          ref = Vinci_ImageT.newTemporary(
                  vc,
                  szFileName = fextref,
                  bLoadAsAtlas = atlas_resample)
  
          if atlas_ref_del:
              os.remove(fextref)
  
      else:
          ref = Vinci_ImageT.newTemporary(
                  vc,
                  szFileName = fref,
                  bLoadAsAtlas = atlas_resample)
      #---------------------------------------------------------------------------
  
      #---------------------------------------------------------------------------
      #> reapply rigid transformation to new image
  
  
      flo = Vinci_ImageT.newTemporary(
              vc,
              szFileName = fflo,
              bLoadAsAtlas = atlas_resample)
  
      rsl = flo.reapplyMMMTransform(
              faff,
              refImage = ref,
              IsComputed=True)
  
      rsl.saveYourselfAs(
              bUseOffsetRotation = True,
              bUseNextNeighbourInterp = interp_nn,
              szFullFileName = fout)
      #---------------------------------------------------------------------------    
  
  
      #> close image buffers for reference and floating
      if close_buff:
          ref.killYourself()
          flo.killYourself()
          rsl.killYourself()
          
  
  
      if close_vinci: con.CloseVinci(True)
  
      return fout