Skip to content
Permalink
02f25a58e6
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
50 lines (39 sloc) 1.25 KB
function dataset_description_BIDS(BIDS,biomax_table)
%
% create BIDS dataset description json file
%
%
% file history:
% created M. Czisch 13.2.2018
% last 2.3.2018
clear jsonstruct;
fprintf('creating data set description\n');
% make file for general remarks
fname_out = [BIDS.output.dir,'/general_README.txt'];
cmd_str = ['touch ', fname_out]; system(cmd_str);
% read general info from master file
fname_out = [BIDS.output.dir,'/general_description_',BIDS.input.data_dir(1).PatientID{3},'.json'];
cmd_str = ['rm -rf ', fname_out]; system(cmd_str);
fid2 = fopen(fname_out,'a');
fname = [BIDS.autoscripts.dir,'/masterfile_1_0_2.json'];
fid = fopen(fname);
last_line = fgetl(fid);
while ~strcmp(last_line,'}')
if strcmp(last_line,'{')
second_to_last_line = last_line;
last_line = fgetl(fid);
else
fprintf(fid2, '%s\n', second_to_last_line);
second_to_last_line = last_line;
last_line = fgetl(fid);
end
end
fprintf(fid2, '%s,\n', second_to_last_line);
% add specific info for current dataset
str = ['"TimeOfConversion": "',char(date),'"'];
fprintf(fid2, ' %s,\n', str);
str = ['"PatientID": "',[BIDS.output.dir],'"'];
fprintf(fid2, ' %s\n', str);
str = '}';
fprintf(fid2, '%s', str);
fclose(fid); fclose(fid2);