Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
function convert_LOG_BIDS(BIDS, biomax_table)
%
% copies the logfiles into BIDS format
%
% Required fields of convert_LOG_BIDS:
%
% file history:
% created M. Czisch & F. Binder 8.11.2017
% last M. Czisch 31.1.2018
cmd_str = sprintf('date >> %s/func/logfile_log_conversion.txt', BIDS.output.dir);
system(cmd_str);
cd([BIDS.input.dir]);
cd('LOG');
% check sanity
% TBD
% create correct file name
PatientID = BIDS.input.data_dir(1).PatientID{3};
tmp = strfind(PatientID,'FOR');
if tmp
short_ID = 'F';
else
short_ID = PatientID(3);
end
tmp = str2num(PatientID(4:7)); % removes leading zeros
tmp_str = num2str(tmp);
short_ID = [short_ID, tmp_str];
filenames = dir([short_ID, '*.log']);
max = size(filenames,1);
% loop over all possible log files
for i=1:max
clear cmd_str;
log_str = [short_ID,'-Hariri.log'];
if strcmp(filenames(i).name,log_str) & biomax_table{{'faces'},{'Log'}}
cmd_str = sprintf('cp %s %s/func/sub-%s_task-hariri_bold.log',log_str, BIDS.output.dir, BIDS.input.data_dir(1).PatientID{3});
system(cmd_str);
end
log_str = [short_ID,'-TET.log'];
if strcmp(filenames(i).name,log_str) & biomax_table{{'TET'},{'Log'}}
cmd_str = sprintf('cp %s %s/func/sub-%s_task-tet_bold.log',log_str, BIDS.output.dir, BIDS.input.data_dir(1).PatientID{3});
system(cmd_str);
end
log_str = [short_ID,'-Nback.log'];
if strcmp(filenames(i).name,log_str) & biomax_table{{'nback'},{'Log'}}
cmd_str = sprintf('cp %s %s/func/sub-%s_task-nback_bold.log',log_str, BIDS.output.dir, BIDS.input.data_dir(1).PatientID{3});
system(cmd_str);
end
log_str = [short_ID,'-reward.log'];
if strcmp(filenames(i).name,log_str) & biomax_table{{'Reward'},{'Log'}}
cmd_str = sprintf('cp %s %s/func/sub-%s_task-reward_bold.log',log_str, BIDS.output.dir, BIDS.input.data_dir(1).PatientID{3});
system(cmd_str);
end
log_str = [short_ID,'-IST_final_122014.log']; %these are the IST which were run with the HDMI box
if strcmp(filenames(i).name,log_str) & biomax_table{{'IST'},{'Log'}}
cmd_str = sprintf('cp %s %s/func/sub-%s_task-ist_bold.log',log_str, BIDS.output.dir, BIDS.input.data_dir(1).PatientID{3});
system(cmd_str);
end
log_str = [short_ID,'-IST_flipped2.log']; %these are the current IST
if strcmp(filenames(i).name,log_str) & biomax_table{{'IST'},{'Log'}}
cmd_str = sprintf('cp %s %s/func/sub-%s_task-ist_bold.log',log_str, BIDS.output.dir, BIDS.input.data_dir(1).PatientID{3});
system(cmd_str);
end
if exist('cmd_str')
logfilename = sprintf('%s/func/logfile_log_conversion.txt', BIDS.output.dir);
fid = fopen(logfilename,'a');
fprintf(fid,'%s\n',cmd_str);
fclose(fid);
end
end
cd([BIDS.input.dir]);