Recover subject ID from BIDS ID

help BIDS experts,

We converted our data to BIDS format. What is the best way to see how the subjects were matched? Which subjects ID corresponds to BIDS ID?



How did you convert to BIDS?


hi Steven,

we used dcm2bids pipeline.


In dcm2bids, the -p argument should contain the subject ID of the written out subject. What was the full command you used to run dcm2bids?

hi Steven,

just waiting for my script file. It was some time ago, since then I changed jobs, so trying to find it :wink: I will let you know asap. thanks for your help A LOT.


hi Steven,

so our function looks like this when we run it in cycle:

bids_cmd = " dcm2bids -d " + participant + ‘/*’ + " -p %03d " % (n+1) + "-o " + out_dir +
" -c /imaging/bids/config.json "


Is that command defined in Python? I want to make sure I am understanding this string generation correctly.

I am just guessing here because there’s clearly some variables that are defined before this command is defined:

I am guessing participant is drawn out from a list of participants, (e.g. participant = participants[n]). Based on the -p argument, the nth participant in that list is being coded as sub-(n+1).

yes, something like that :wink:

the output looks liek this:

sbatch --mem-per-cpu=6gb --time=01:00:00 --job-name=dcm2bids --output /imaging/bids/sub-001-dcm2bids.out dcm2bids -d /imaging/data/100.tgz/* -p 001 -o /imaging/bids/ -c /imaging/bids/config.json

the problem is how to recover correct information or fron log file? or there is another way to read it out.


Is 100 a subject ID from your original set? If so, for this particular subject, 100 (original) = 001 (BIDS).

In the future, assuming your original IDs are deidentified, it might just be easier to just use that as your BIDS ID for lack of confusion.

I get it if I ran it one per one, I know this: 100 = 001 (in BIDS). But I think when all analysis is done how can i find all subjects with this input output data?
Is there is a place where this information is automatically saved?
If I will rerun this convertion, will I get the same result?

any ideas?

make sense!!! good tip for the same ID.

Can you see how participant Is defined in your script? Again, if this is all happening in a loop, then the nth subject in that list goes to n+1 for BIDS subject ID.