-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorganizeconcatData.m
45 lines (39 loc) · 1.79 KB
/
organizeconcatData.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
% Get subject numbers for everyone in LMB_Analysis folder
root_dir = '/mnt/diskArray/projects/LMB_Analysis';
%sub_list = HCP_autoDir(root_dir);
%sub_list = {'NLR_110_HH','NLR_145_AC','NLR_150_MG','NLR_160_EK','NLR_161_AK'...
% 'NLR_162_EF','NLR_163_LF','NLR_164_SF','NLR_170_GM','NLR_174_HS'};
sub_list = {'NLR_IB357'};
% sub_list = {'NLR_GB310','NLR_GB355','NLR_GB387','NLR_GB267','NLR_JB420',...
% 'NLR_JB423','NLR_197_BK','NLR_KB218','NLR_HB275'};
% For each subject (si = subject index)
for si = 1:length(sub_list)
% Get the visit dates
visit_dir = strcat(root_dir,'/',sub_list{si});
cd(visit_dir)
mkdir('concatVistaAligned')
concatDir = strcat(visit_dir,'/concatVistaAligned');
visit_dates = HCP_autoDir(visit_dir);
% For each visit (vi = visit index)
for vi = 1:length(visit_dates)
% Check to see if the vist date folder is actually a date
a = visit_dates{vi};
sizeA = size(a);
sizeA = sizeA(2);
if sizeA == 8
raw_dir = strcat(root_dir, '/', sub_list{si}, '/',visit_dates{vi},'/raw');
cd(raw_dir);
EPI_names = dir('*EPI_106VOL*.PAR'); % check the raw directory for 70V functionals
nFunctionals = size(EPI_names);
nFunctionals = nFunctionals(1);
if ~isempty(EPI_names) %If there are functionals, make fmri directory and convert parrec files
% Convert to nifti and sace into functional directory
for fi = 1:nFunctionals
parrecCommand = strcat('parrec2nii -o', {' '},concatDir,{' '},'-c -b',{' '},EPI_names(fi).name);
parrecCommand = parrecCommand{1};
system(parrecCommand)
end
end
end
end
end