Permalink
Cannot retrieve contributors at this time
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?
test/convert_LOG_BIDS.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
86 lines (69 sloc)
2.79 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); |