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 BIDS = OPTIMA_repair_BIDS_1_0_2_dwi2(input_dir)
%
% Repair dwi2 (pepolar)
% here, manual stopping of acquisition leaves dicom slices of an incomplete
% last volume. These interfer with dcm2niix and therefore need to be
% deleted
%
% Required fields of repair_BIDS_1_0_2_dwi2:
%
% 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/OPTIMA/autoscripts_BIDS'
%
% function call, e.g.: OPTIMA_repair_BIDS_1_0_2_dwi2('/run/media/spectro/DATAPART1/OPTIMA/Garching2/PTP0070_T7')
%
% structure BIDS
% input.dir - directory with verified data
% e.g. BIDS.input.dir = '/run/media/spectro/DATAPART1/OPTIMA/Garching2/PTP0070_T7'
% input.biomax - biomax_out filename
%
% file history:
% created M. Czisch 29.5.2020
% to repair BecomeVersion 1.0.2
% adapted for OPTIMA 13.11.2020
fprintf('\nRepair BIDS \n');
clear BIDS
BIDS.input.dir = input_dir;
BIDS.output.dir = '';
BIDS.autoscripts.dir = '/run/media/spectro/DATAPART1/OPTIMA/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'];
if ~exist(BIDS.output.dir)
mkdir(BIDS.output.dir);
mkdir([BIDS.output.dir,'/dwi']);
end
% load and format biomax_out info
biomax = load(BIDS.input.biomax);
biomax_table = array2table(biomax,...
'VariableNames',{'Ser','Log','EDF','PPG'},...
'RowNames',{'Loc';'T1w';'Cal';'rest1';...
'EPI1';'FLAIR';'SIT1';...
'DTI';'Pepolar'});
% read content of GE EXAM and SERIES files
BIDS = OPTIMA_read_GE_BIDS_4(BIDS);
% do repair
cd(input_dir);
OPTIMA_repair_convert_GE_dwi2_to_BIDS(BIDS, biomax_table);
fprintf('\n\ndone repair of %s\n', BIDS.input.data_dir(1).PatientID{3});
clear all