-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy paths_fe_fit_predator_cull_150.m
59 lines (47 loc) · 2.06 KB
/
s_fe_fit_predator_cull_150.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
46
47
48
49
50
51
52
53
54
55
56
57
58
function fe = s_fe_fit_predator_cull_150()
%
% This function:
% - Loads a LIFE structure and culls it
%
% fe = s_fe_fit_predator_cull(subjects_to_run)
%
% INPUTS: none
% OUTPUTS: fe structure the optimized life structure
%
% Copyright Franco Pestilli (2014) Vistasoft Stanford University
if notDefined('recompute'), recompute = true; end % is true will recumpute the file and overwrite it
% Get the base directory for the data
% Get the base directory for the data
datapath = '/marcovaldo/frk/2t2/predator/';
subjects = {'FP_150dirs_b1000_2000_4000_2iso'};
for isbj = 1
% Directory where to save the fe structures
savedir = fullfile(datapath,subjects{isbj},'connectomes');
feFiles = dir(fullfile(savedir,sprintf('*1000*lmax*.mat')));
% We build one modelper fiber group, whole brain fiber group
for iFes = 1:length(feFiles)
% The final connectome and dat astructure will be saved with this name:
[~,feFileName] = fileparts(feFiles(iFes).name);
feTempPath = fullfile(savedir,feFileName);
if (exist([feTempPath,'.mat'],'file') == 2)
if ~(exist([feTempPath,'_culled.mat'],'file') == 2) || recompute == true
% Intialize a local matlab cluster if the parallel toolbox is available.
feOpenLocalCluster;
fprintf('[%s] Loading the FE structure...\n %s \n', mfilename,[feTempPath,'.mat'])
load([feTempPath,'.mat'])
% Initialize the Connectome
[fe,cull] = feConnectomeCull(fe);
fprintf('[%s] Saving the FE structure and the culling info...\n %s \n', mfilename,[feTempPath,'_culled.mat'])
save([feTempPath,'_culled.mat'],'fe','cull','-v7.3');
clear fe
% Close the matlab pool, this will limit the amount of memory build up
matlabpool close force local
end
else
fprintf('[%s] FE file not found, skipping...\n %s \n', mfilename,[feTempPath,'.mat'])
end
end
end
% Exit matlab
exit
return