Change a Condition name using script

Hi.

I am writing here because I would like to change the name of some condition in my protocol.
Now, they have complicated name like :'NIRSCOMP_2017-07-12_S02_0003'. I can rename them by changing the folder name manually in the database and then reloading it. But i would like to be able to set it with a script during the importation process.

I've try this :

% Input files
sFiles = [];
SubjectNames = {...
'Subject03'};
RawFiles = {...
'/lena13/home_users/users/ext-e.delaire/Desktop/NIRS_EEG/NIRSCOMP_work_folder/2017-07-13_S03/NIRS/2017-07-13_004/NIRSCOMP_S03-2017-07-13_004.nirs' };

% Start a new report
bst_report('Start', sFiles);

% Process: Create link to raw file
sFiles = bst_process('CallProcess', 'process_import_data_raw', sFiles, [], ...
'subjectname', SubjectNames{1}, ...
'datafile', {RawFiles{1}, 'NIRS-BRS'}, ...
'channelreplace', 1, ...
'channelalign', 1, ...
'evtmode', 'value');

[sStudies,iStudies]=bst_get('Study');

sStudies.Name='S03';
sStudies.Condition={'GraspingRight'};
bst_set('Study', iStudies, sStudies);

% Save and display report

ReportFile = bst_report('Save', sFiles);
bst_report('Open', ReportFile);
% bst_report('Export', ReportFile, ExportDir);

But it doesn't work : My goal is to have NIRSCOMP_S03... in the GraspingRight condition :
Screenshot

Another question, is there already a structure that can hold demographics data for each subjects ( like age...) that might be used for group analysis ?

Best,
Edouard

Hello

The folders with the “raw” tags (starting on the hard drive with @raw" are links to continuous files, their names is the name of the input files, then cannot be renamed.
The folders containing imported data can be renamed easily (see function db_rename_condition).
However, the current database structure does not support subfolders. You can only have one folder level in the subjects.

Two recommendations:

  • do not try to alter these structures manually or you may damage definitely your daatabase.
  • avoid using the @ character in your folder names, they have a special meaning for Matlab, and it may cause some problems.

Another question, is there already a structure that can hold demographics data for each subjects ( like age…) that might be used for group analysis ?

No, Brainstorm is not very rich regarding the data organization…

2 Likes

Hi.
Surprisingly db_rename_condition worked. I think that's because I am importing event to the file, so it's imported in the database. Anyway, now I have my conditions well organized :slight_smile:

thx