Donders-Institute / bidscoin

BIDScoin converts your source-level neuroimaging data to BIDS
https://bidscoin.readthedocs.io
GNU General Public License v3.0
131 stars 35 forks source link

Add only existing jsonfiles to jsonfiles and make it set #215

Closed dzemanov closed 10 months ago

dzemanov commented 10 months ago

Sometimes is the return code of running dcm2niix success even though no nii files, therefore no json files were produced. This means that jsonfiles will need to remove <outfolder/bidsname.json> as it doesn't exist.

This code changes jsonfiles to set and only adds jsonfiles if they exist, meaning no need of removing nonexistent jsonfiles. Maybe continue can be added not only for if return code is not success, but also if no nii files are produced?

marcelzwiers commented 10 months ago

Thanks, I have never come across this myself, but it looks like a clean solution. And I agree, set() is indeed a much better datatype to use here :-)