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 OPTIMA_convert_PPG_BIDS_2(BIDS, biomax_table)
%
% copies the ppg files into BIDS format
%
%
% file history:
% created M. Czisch 12.9.2019
sum_table = sum(biomax_table{:,{'PPG'}});
if sum_table > 0
fprintf('converting PPG and RESP files\n');
% create correct file name
%short_ID = data_set_short_ID(BIDS);
tmp_str = strsplit(BIDS.input.data_dir(1).PatientID{3},'PTP');
%short_ID = ['P',tmp_str{2}];
short_ID = ['P1808'];
cmd_str = sprintf('mkdir %s/physio', BIDS.output.dir); system(cmd_str);
cmd_str = sprintf('date >> %s/physio/logfile_%s_ppg_resp_conversion.txt', BIDS.output.dir, BIDS.input.data_dir(1).PatientID{3});
system(cmd_str);
cd([BIDS.input.dir]);
cd('PPG');
filenames_ppg = dir(['PPGData_epiRT_*']);
max = size(filenames_ppg,1);
filenames_resp = dir(['RESPData_epiRT_*']);
% if max ~= sum_table
% error('Error. \nnumber of ppg files does not match biomax_out\n');
% end
j = 1;
clear cmd_str;
if biomax_table{4,{'PPG'}} % rest1
cmd_str = sprintf('cp %s %s/physio/sub-%s_task-rest_run-1_ppg.txt',filenames_ppg(j).name, BIDS.output.dir, BIDS.input.data_dir(1).PatientID{3});
system(cmd_str); print2log(cmd_str);
cmd_str = sprintf('cp %s %s/physio/sub-%s_task-rest_run-1_resp.txt',filenames_resp(j).name, BIDS.output.dir, BIDS.input.data_dir(1).PatientID{3});
system(cmd_str); print2log(cmd_str);
j = j+1;
end
if biomax_table{7,{'PPG'}} % SIT1
cmd_str = sprintf('cp %s %s/physio/sub-%s_task-sit1_ppg.txt',filenames_ppg(j).name, BIDS.output.dir, BIDS.input.data_dir(1).PatientID{3});
system(cmd_str); print2log(cmd_str);
cmd_str = sprintf('cp %s %s/physio/sub-%s_task-sit1_resp.txt',filenames_resp(j).name, BIDS.output.dir, BIDS.input.data_dir(1).PatientID{3});
system(cmd_str); print2log(cmd_str);
j = j+1;
end
end
cd([BIDS.input.dir]);
function print2log(cmd_str)
logfilename = sprintf('%s/physio/logfile_%s_ppg_resp_conversion.txt', BIDS.output.dir, BIDS.input.data_dir(1).PatientID{3});
fid = fopen(logfilename,'a');
fprintf(fid,'%s\n',cmd_str);
fclose(fid);
end
end