Hi all
I’m trying to extract the statical data for multiple subjects using the aparcstats2table program in freesurfer.
I used this command to extract the statical data for one subject.
The --subjects argument of the command can take multiple subjects, delimited by spaces, e.g. --subject SUB01 SUB02...
As long as your Freesurfer subjects directory is pointed to your Freesurfer outputs (e.g. setenv SUBJECTS_DIR (full path to subject dir), you can just supply the subject IDs in the --subjects argument.
For example,
1, Go to your freesurfer directory: cd $SUBJECTS_DIR
2. Get all subjects: subjects=$(ls sub*) - that assumes that all subject folders begin with sub, but you can change it to work with your data.
3. Run your command, with --subjects ${subjects[@]}
Thanks for your response, Steven.
actually, I have four folders inside my subjects directory. each folder has different subjects. and I’m aiming to extract the stats data for each folder in a single excel file.
You can make a new folder that contains symlinks/shortcuts to the subject data in the different folders (see the ln -s command). Then set the subject directory environment variable to the folder that contains these shortcuts.
(those are the links for the four folders)
how can I access the subjects inside the links? I think freesurfer could not collect them in the subjects variable
You should create a single folder that contains the links to the subjects contained in all of those four folders. So, looking at subjects in CN_Male_Subjects, for example, you should send a shortcut of each of the subject folders to your final directory where you want to have all subjects represented, and the repeat for the other 3 bigger folders. See more about the ln command here: https://linuxize.com/post/how-to-create-symbolic-links-in-linux-using-the-ln-command/