forked from cortex-lab/Suite2P
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_pipeline.m
60 lines (48 loc) · 1.54 KB
/
run_pipeline.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
59
60
function run_pipeline(db, ops0, clustrules)
ops = build_ops3(db, ops0);
if ops.useGPU
gpuDevice(1); % reset GPU at each dataset
end
%
clustModel = getOr(ops, {'clustModel'}, 'standard');
neuropilSub = getOr(ops, {'neuropilSub'}, 'surround');
ops1 = reg2P(ops); % do registration
%%
for i = 1:length(ops.planesToProcess)
iplane = ops.planesToProcess(i);
ops = ops1{i};
ops.niterclustering = 40;
ops.iplane = iplane;
if numel(ops.yrange)>ops.Ly/2 && numel(ops.xrange)>ops.Lx/2
if ops.getSVDcomps
ops = get_svdcomps(ops);
end
if ops.getROIs
[ops, U, Sv] = get_svdForROI(ops);
%
U = reshape(U, [], size(U,3));
switch clustModel
case 'standard'
[ops, stat, res] = fast_clustering(ops,U, Sv);
case 'neuropil'
[ops, stat, res] = fast_clustering_with_neuropil(ops,U, Sv);
end
%
apply_ROIrules(ops, stat, res, clustrules);
%
switch neuropilSub
case 'surround'
get_signals_and_neuropil(ops, iplane);
case 'none'
get_signals(ops, iplane);
case 'model'
get_signals_NEUmodel(ops, iplane);
end
end
end
if ops.DeleteBin
delete(ops.RegFile); % delete temporary bin file
end
end
% clean up
fclose all;