My sample folders are organized in this way.
I use Philips fMRI data from ADNI, and each subject has different imaging date numbers. In other words, multiple subjects with multiple sessions without any rule.
Every session (indicated as date; e.g. 20120103, 20130506) for each subject has same study id and study instance UID. Should the data has different study id or study instance UID for each session?
- Myproject
- Dicom2
- 130S4883
- 20120103
- anat
- func
- 20130506
- anat
- func
- 20120103
- 136S4517
- 20140506
- anat
- func
- 20151104
- anat
- func
- 20161107
- anat
- func
- 20140506
- 130S4883
- Dicom2
And I used heudiconv on Linux terminal.
The code I used is attached below.
for subject in $(ls -1 /home/rrt/MyProject/Dicom2/); do
for session in $(ls -1 /home/rrt/MyProject/Dicom2/${subject/}); do
sudo docker run --rm -it
-v /home/rrt/MyProject:/base
nipy/heudiconv:latest
-d /base/Dicom2/{subject}/{session}/* /*.dcm
-o /base/Nifti2_sess2/
-f /base/Nifti2_sess2/code/convertall.py
-s ${subject}
-ss ${session}
-c dcm2niix -b
–overwrite;
done;
done