Heudiconv Automation Script

Hi everyone,

I have a txt file of subjects that I want to run a heudiconv sh script on. Does anyone have an automation script on how to automatically run heudiconv on the subjects in the txt file. The txt file looks like this.

xnat:mrsessiondata/label
651468L

xnat is the header and subject ID is 651468L. The session number will always be 1. So I know there is a way to use subprocess in python to read shell scripts but how do you get it to automate so I don’t have to keep manually doing it? Just run the python script and it will automatically run heudiconv if the BIDS directory does not exist?

If anyone has an automation script they could share that would be great.

Thanks.

–Subbi M.