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/repair_BIDS_1_0_2.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
84 lines (57 sloc)
2.21 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 BIDS = repair_BIDS_1_0_2(input_dir) | |
% | |
% Repair datasets for BIDS format, i.e. add missing PPG and RESP files | |
% this is not required for BIDS conversions 1.0.2 or higher | |
% | |
% Required fields of make_BIDS: | |
% | |
% input_dir - location of the GE data, use absolute path | |
% | |
% data must have passed consistency checks using | |
% consistency.m in MICHA_TEST/FA_consistency | |
% the script is expecting a file named | |
% "biomax_out_*_VERIFIED*.txt" or | |
% "biomax_out_*_MODIFIED*.txt" | |
% to be present in the subjects main directory | |
% | |
% directories must be known: | |
% addpath '/run/media/spectro/DATAPART1/FORSCHUNGSAMBULANZ/autoscripts_BIDS' | |
% | |
% function call, e.g.: repair_BIDS('/run/media/spectro/DATAPART1/FORSCHUNGSAMBULANZ/FOK0084') | |
% | |
% structure BIDS | |
% input.dir - directory with verified data | |
% e.g. BIDS.input.dir = '/run/media/spectro/DATAPART1/MICHA_TEST/FOR0015' | |
% input.biomax - biomax_out filename | |
% | |
% file history: | |
% created M. Czisch 29.5.2018 | |
% to repair BecomeVersion 1.0.1 | |
fprintf('\nRepair BIDS \n'); | |
clear BIDS | |
BIDS.input.dir = input_dir; | |
BIDS.output.dir = ''; | |
BIDS.autoscripts.dir = '/run/media/spectro/DATAPART1/FORSCHUNGSAMBULANZ/autoscripts_BIDS'; | |
% have the data being for consistency checked already? | |
% does biomax_out exist? | |
BIDS = check_BIOMAX(BIDS); | |
% check and prepare temporary BIDS directory structure | |
pathInfo = what(BIDS.input.dir); | |
current_dir = pathInfo.path; | |
tmp_str = strsplit(current_dir,'/'); | |
BIDS.output.dir = [current_dir,'/',tmp_str{end},'_BIDS']; | |
% load and format biomax_out info | |
biomax = load(BIDS.input.biomax); | |
biomax_table = array2table(biomax,... | |
'VariableNames',{'Ser','Log','EDF','PPG','Analyzer','Blood'},... | |
'RowNames',{'Loc';'T1w';'Cal';'rest1';... | |
'EPI1';'TET';'FLAIR';'Reward';... | |
'DTI';'Pepolar';'nback';'Loc2';... | |
'Cal2';'faces';'EPI2';'rest2';... | |
'IST';'Loc3';'rest3'}); | |
% read content of GE EXAM and SERIES files | |
BIDS = read_GE_BIDS(BIDS); | |
% do repair | |
repair_PPG_BIDS(BIDS, biomax_table); | |
fprintf('\n\ndone repair of %s\n', BIDS.input.data_dir(1).PatientID{3}); | |
clear all | |