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?
NMR_OPTIMA_BIDS/OPTIMA_dataset_func_description_BIDS_3.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
74 lines (62 sloc)
3.24 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 OPTIMA_dataset_func_description_BIDS_3(BIDS,fname_in,biomax_vec) | |
% | |
% create BIDS dataset description json file | |
% for the functional data | |
% | |
% file history: | |
% created M. Czisch 19.2.2018 | |
clear jsonstruct; | |
% read general info from master file | |
fname_out = [BIDS.output.dir,'tmp.json']; | |
cmd_str = ['rm -rf ', fname_out]; system(cmd_str); | |
fid2 = fopen(fname_out,'a'); | |
fname = fname_in; | |
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); | |
short_ID = data_set_short_ID(BIDS); | |
str = ['"PatientID": "',[BIDS.output.dir],'"']; fprintf(fid2, ' %s,\n', str); | |
str = ['"NumberShots": 1']; fprintf(fid2, ' %s,\n', str); | |
str = ['"ParallelAcquisitionTechnique": "ASSET"']; fprintf(fid2, ' %s,\n', str); | |
str = ['"ParallelReductionFactorInPlane": 2']; fprintf(fid2, ' %s,\n', str); | |
str = ['"PhaseEncodingDirection": "j"']; fprintf(fid2, ' %s,\n', str); | |
str = ['"SliceEncodingDirection": "k"']; fprintf(fid2, ' %s,\n', str); | |
str = ['"NumberOfVolumesDiscardedByScanner": 0']; fprintf(fid2, ' %s,\n', str); | |
str = ['"NumberOfVolumesDiscardedByUser": 0']; fprintf(fid2, ' %s,\n', str); | |
if logical(strfind(fname,'task-ist_bold')) | |
str = ['"NumberSlices": 40']; fprintf(fid2, ' %s,\n', str); | |
str = ['"SliceTiming": [0.00, 1.00, 0.05, 1.05, 0.10, 1.10, 0.15, 1.15, 0.20, 1.20,'... | |
'0.25, 1.25, 0.30, 1.30, 0.35, 1.35, 0.40, 1.40, 0.45, 1.45,'... | |
'0.50, 1.50, 0.55, 1.55, 0.60, 1.60, 0.65, 1.65, 0.70, 1.70,'... | |
'0.75, 1.75, 0.80, 1.80, 0.85, 1.85, 0.90, 1.90, 0.95, 1.95]']; fprintf(fid2, ' %s,\n', str); | |
else | |
str = ['"NumberSlices": 42']; fprintf(fid2, ' %s,\n', str); | |
str = ['"SliceTiming": [0, 1.2500, 0.0595, 1.3095, 0.1190, 1.3690, 0.1786, 1.4286,'... | |
'0.2381, 1.4881, 0.2976, 1.5476, 0.3571, 1.6071, 0.4167, 1.6667,'... | |
'0.4762, 1.7262, 0.5357, 1.7857, 0.5952, 1.8452, 0.6548, 1.9048,'... | |
'0.7143, 1.9643, 0.7738, 2.0238, 0.8333, 2.0833, 0.8929, 2.1429,'... | |
'0.9524, 2.2024, 1.0119, 2.2619, 1.0714, 2.3214, 1.1310, 2.3810, 1.1905, 2.4405]']; | |
fprintf(fid2, ' %s,\n', str); | |
end | |
str = sprintf('"MRIDataExist": %d', biomax_vec(1)); fprintf(fid2, ' %s,\n', str); | |
str = sprintf('"LogFileExist": %d', biomax_vec(2)); fprintf(fid2, ' %s,\n', str); | |
str = sprintf('"EyeTrackerExist": %d', biomax_vec(3)); fprintf(fid2, ' %s,\n', str); | |
str = sprintf('"PhysioDay1Exist": %d', biomax_vec(4)); fprintf(fid2, ' %s,\n', str); | |
%str = sprintf('"PhysioDay2Exist": %d', biomax_vec(5)); fprintf(fid2, ' %s\n', str); | |
str = '}'; | |
fprintf(fid2, '%s', str); | |
fclose(fid); fclose(fid2); | |
cmd_str = sprintf('mv %s %s', fname_out, fname); system(cmd_str); |