How to bids-convert only bold runs with a minimum number of timepoints in bidscoin?

I am using bidscoin to convert my raw DICOMS to BIDS. My sourcedata has not been organized by runs, so bidscoin will automatically assign a run-number if it finds identical bold runs for the same subject and the same session (I guess the run number is based on the acquisition time?).

My problem: Some of the runs do not have the expected number of timepoints. This is very likely because the MRI session was interrupted and had to be restarted again. So the last run is always the one that has the expected number of timepoints.

I could of course manually remove those runs after the BIDS-conversion by reading in each bold file and checking its shape against an expected number of timepoints (then move it to a different folder along with it’s .json sidecar) but that seems quite complex (besides the corresponding sub-+_ses-*_scans.tsv file then also would contain entries that point to non-existing files.

i wonder if bidscoin has built-in capability to do this?

Hi @JohannesWiesner,

If you run dcm2niix separately before BIDSCoin, and organize the data as described here (Data organization — BIDScoin 4.6.3.dev0 documentation), you can add imaging metadata (e.g., number of timepoints) to the JSONS (should be easy with Python JSON and Nibabel libraries), and then use that field as a criterion for BIDSCoin.

Best,
Steven