help > How to keep subject name as input file name when importing instead of "Subject 1"
Showing 1-2 of 2 posts
Display:
Results per page:
Apr 3, 2021  12:04 AM | Jordan Galbraith
How to keep subject name as input file name when importing instead of "Subject 1"
Our lab just started using CONN and use the GUI. We can't figure out how to keep the name of our participants/their 5 digit code when importing their data since the subject names automatically show up as "Subject 1", "Subject 2", etc and need to track characteristics of the subjects within CONN. We could assume it is importing in the order that they are listed in the directory, but that seems a big assumption and I'd rather them import without renaming them generically. Any help is appreciated!
Apr 10, 2021  06:04 PM | Alfonso Nieto-Castanon - Boston University
RE: How to keep subject name as input file name when importing instead of "Subject 1"
Hi Jordan,

Sorry CONN's GUI always uses sequential subject numbers as IDs. If you are using the GUI to import your data then yes, the data will be imported using alphanumeric sorting of folder/filenames. In any way, one quick/simple way to check the order in which your data has been imported is to list all structural files in your CONN project (assuming you have one structural per subject) using something like:

   char(conn_module('get','structurals'))

which will return something like the following:

'/Volumes/ext20/Cambridge/Cambridge_Buckner_part4/sub93269/anat/mprage_anonymized.nii'
'/Volumes/ext20/Cambridge/Cambridge_Buckner_part4/sub93488/anat/mprage_anonymized.nii'
'/Volumes/ext20/Cambridge/Cambridge_Buckner_part4/sub93609/anat/mprage_anonymized.nii'
'/Volumes/ext20/Cambridge/Cambridge_Buckner_part4/sub94304/anat/mprage_anonymized.nii'
'/Volumes/ext20/Cambridge/Cambridge_Buckner_part4/sub95187/anat/mprage_anonymized.nii'
'/Volumes/ext20/Cambridge/Cambridge_Buckner_part4/sub95644/anat/mprage_anonymized.nii'
... etc.

Sometimes it is useful to create a "subject ID" code and enter that into CONN for safekeeping. For example, in the example above, perhaps you would like to read the "sub####" portion of those filenames as a new ID variable using something like:

   ID = str2double(regexp(conn_module('get','structurals'),'(?<=sub)\d+','match','once'));

That would allow you to then save those ID values into CONN as a new 2nd-level covariate using something like:

   conn_module( 'set', 'l2covariates', ID(:), {'ID'}, {'IDs read from filenames'}, true);

Hope this helps
Alfonso

Originally posted by Jordan Galbraith:
Our lab just started using CONN and use the GUI. We can't figure out how to keep the name of our participants/their 5 digit code when importing their data since the subject names automatically show up as "Subject 1", "Subject 2", etc and need to track characteristics of the subjects within CONN. We could assume it is importing in the order that they are listed in the directory, but that seems a big assumption and I'd rather them import without renaming them generically. Any help is appreciated!