Heudiconv across multiple sessions

bids
heudiconv

#1

Does anyone have a simple example of a heudiconv command inputting multiple sessions? I may be missing something obvious, but I am not able to get the command below to work.

setenv TEST 001
setenv SUBJ sub-$TEST
setenv DATA /autofs/cluster/<path to data>
setenv WORK /autofs/cluster/<path to personal folder>
setenv IMAGE /autofs/cluster/<path to singularity image>
setenv SINGULARITY <path to singularity command
mkdir /scratch/raw_dicom && cp -r $DATA/dicom/$SUBJ /scratch/raw_dicom/
mkdir /scratch/heuristic && cp -r $WORK/heudiconv/heuristics/FSMAP/*convert*.py /scratch/heuristic/

$SINGULARITY exec --bind '/scratch:/scratch' $IMAGE \
/neurodocker/startup.sh heudiconv \
-d '/scratch/raw_dicom/{subject}/ses-{session}/*/MR.*' \
-s $TEST \
-ss 01 02 \
-f /scratch/heuristic/FSMAP_convert_ses-01.py \
-c dcm2niix -b --minmeta \
-o /scratch/$SUBJ

This returns the error:

usage: heudiconv [-h] [--version]
             [-d DICOM_DIR_TEMPLATE | --files [FILES [FILES ...]]]
             [-s [SUBJS [SUBJS ...]]] [-c {dcm2niix,none}] [-o OUTDIR]
             [-a CONV_OUTDIR] [--anon-cmd ANON_CMD] -f HEURISTIC_FILE [-p]
             [-ss SESSION] [-b] [--overwrite] [--datalad] [--dbg]
             [--command {treat-json,ls,populate-templates}]
             [-g {studyUID,accession_number}] [--minmeta] [-q QUEUE]
             [--sbargs SBATCH_ARGS]
heudiconv: error: unrecognized arguments: 02

This is obviously something simple, but I couldn’t find much documentation on multi session conversion, so thought I would ask!


#2

@jordan_theriault currently we only support one input for the session flag, so you’ll have to call heudiconv twice if you want to convert ses-01 and ses-02


#3

Ahh thanks for the clarification. The Github documentation and the usage message (above) suggest that session can be used, so it might be helpful to correct those when you have a chance.

Thanks again!


#4

The usage message just says what it does support - a single session definition: [-ss SESSION], compare to --files for example of an option accepting multiple inputs: --files [FILES [FILES ...]]

But your heuristic (in infotoids) could deduce session identifier for every accession, so if the path you pointed has multiple accessions, it could assign corresponding multiple/different sessions to each accession it is to process. See e.g. ReproIn heuristic – we are typically assigning session identifier to the scout scan. It also supports _ses-{date} and _ses+ identifiers so session would either correspond to the date (used for our QA phantom scans) or just incremented each time correspondingly.

Hope this helps