docs: def proc_anat(config, args):
      '''
      Download anatomical data and convert to BIDS
      '''
      refs = dict()
      for scan in iterconfig(config, 'anat'):
          ref = scan.get('id', None)
          templ = 'sub-${sub}_ses-${ses}'
          if 'acquisition' in scan:
              templ += '_acq-${acquisition}'
          if 'run' in scan:
              templ += '_run-${run}'
          templ += '_${modality}'
          templ = string.Template(templ)
          fbase = templ.safe_substitute(
              sub=legal.sub('', args.subject),
              ses=legal.sub('', args.session),
              acquisition=scan.get('acquisition', None),
              run=scan.get('run', None),
              modality=scan.get('modality', None),
          )
          # download data to bids sourcedata directory
          sourcedata_dir = os.path.join(args.sourcedata, scan['type'])
          if not os.path.exists(sourcedata_dir):
              os.makedirs(sourcedata_dir)
          dicom_dir = os.path.join(sourcedata_dir, '{0}.dicom'.format(fbase))
          logger.info('downloading session=%s, scan=%s, loc=%s', args.session, scan['scan'], dicom_dir)
          args.xnat.download(args.session, [scan['scan']], out_dir=dicom_dir)
          # convert to nifti
          fname = '{0}.nii.gz'.format(fbase)
          refs[ref] = os.path.join(scan['type'], fname)
          fullfile = os.path.join(args.bids, scan['type'], fname)
          logger.info('converting %s to %s', dicom_dir, fullfile)
          convert(dicom_dir, fullfile)
      return refs