123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- parent_path = "E:\Projects\CBIrep_Imaging\Raw";
- cd (parent_path)
- addpath("..\scripts\toolbox\DVARS-master\")
- addpath("..\scripts\toolbox\DVARS-master\Nifti_Util\")
- addpath("..\scripts")
- addpath("..\scripts\toolbox\spm12")
- addpath("..\scripts\toolbox\fMRI-Quality-Checker-master")
- addpath("..\scripts\toolbox\spm12\matlabbatch")
- addpath("..\scripts\toolbox\nifti_utils-master\")
- %% Preps
- BIDS_path = "E:\Projects\CBIrep_Imaging\subjects";
- % physio_files = "F:\Projects\StrokePT_tDCS_rsfmri\physio";
- % cd (physio_files)
- % phx = dir("SB*");
- timeX = {'tpA','tpB','tpC','tpD','tpE','tpF','tpG'};
- %% level1: subjects
- cd (parent_path)
- gx = dir("sub*");
- for g = 18:length(gx)
- subject = gx(g).name;
- cd (fullfile(gx(g).folder,gx(g).name,"MRI/"))
- %% level2: timepoints
- tx = dir('tp*');
- for t = 1:length(tx)
- time = tx(t).name;
- cd (fullfile(tx(t).folder,tx(t).name))
- session = strcat('ses-',num2str(find(strcmp(time,timeX))));
- %% level3: scans
- % copy data to BIDS
- folder_from = pwd;
- folder_to = fullfile(BIDS_path,subject,session);
-
- if ~exist(folder_to,"dir")
- mkdir(folder_to)
- end
- % copy MRI data
- copyfile(folder_from,folder_to)
-
- % % % % % copy physio data
- % % % % if exist("physiofolder","var")
- % % % % physio_to = fullfile(folder_to,"physio",phx(physioID).name);
- % % % % if ~exist(physio_to,"dir")
- % % % % mkdir(physio_to)
- % % % % end
- % % % % copyfile(physiofolder,physio_to);
- % % % % end
- %%
- cd (folder_to)
- if exist("fMRI","dir")==7
- movefile("fMRI","func")
- end
- if exist("T2w\","dir")==7
- movefile("T2w","anat")
- end
- end
- end
|