-
Notifications
You must be signed in to change notification settings - Fork 147
/
demo_script_class.m
61 lines (47 loc) · 2.24 KB
/
demo_script_class.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
61
clear;
gcp;
% same demo as demo_script.m but using the class @CNMF
%% load file
addpath(genpath('utilities'));
addpath(genpath('deconvolution'));
CNM = CNMF; % contruct CNMF object
filename = 'demoMovie.tif'; % filename to be processed
K = 40; % number of components to be found
options = CNMFSetParms(...
'p',2,... % order of AR dynamics
'gSig',5,... % half size of neuron
'merge_thr',0.80,... % merging threshold
'nb',2,... % number of background components
'min_SNR',3,... % minimum SNR threshold
'space_thresh',0.5,... % space correlation threshold
'cnn_thr',0.2... % threshold for CNN classifier
);
%%
% Below is the standard processing pipeline. This processing can be
% executed in one shot using the CNM.fit function:
% CNM.fit(filename,options,K)
%% load the dataset and create the object
CNM.readFile(filename); % insert path to file here
CNM.optionsSet(options); % setup the options structure
%% Process the dataset
CNM.preprocess; % preprocessing (compute some quantities)
CNM.initComponents(K); % initialization
CNM.plotCenters() % plot center of ROIs detected during initialization
CNM.updateSpatial(); % update spatial components
CNM.updateTemporal(0); % update temporal components (do not deconvolve at this point)
%% component classification
CNM.evaluateComponents(); % evaluate spatial components based on their correlation with the data
CNM.CNNClassifier('') % evaluate spatial components with the CNN classifier
CNM.eventExceptionality(); % evaluate traces
CNM.keepComponents(); % keep the components that are above certain thresholds
%% merge found components
CNM.merge();
CNM.displayMerging();
%% repeat processing
CNM.updateSpatial();
CNM.updateTemporal();
CNM.extractDFF(); % extract DF/F values.
%% do some plotting
figure;
CNM.plotContours();
CNM.plotComponentsGUI(); % display all components