Skip to content

Commit da46929

Browse files
committed
updated demos
1 parent f8dc452 commit da46929

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

demo_memmap.m

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
% demo script for splitting the field of view in patches and processing in parallel
2+
% through memory mapping. See also run_pipeline.m for the complete
3+
% pre-processing pipeline of large datasets
4+
15
clear;
26
%% load file
37

@@ -47,11 +51,25 @@
4751

4852
[A,b,C,f,S,P,RESULTS,YrA] = run_CNMF_patches(data,K,patches,tau,p,options);
4953

50-
%% order and plot
54+
%% classify components
55+
[ROIvars.rval_space,ROIvars.rval_time,ROIvars.max_pr,ROIvars.sizeA,keep] = classify_components(data,A,C,b,f,YrA,options);
56+
57+
%% run GUI for modifying component selection (optional, close twice to save values)
58+
Cn = reshape(P.sn,sizY(1),sizY(2)); % background image for plotting
59+
run_GUI = false;
60+
if run_GUI
61+
Coor = plot_contours(A,Cn,options,1); close;
62+
GUIout = ROI_GUI(A,options,Cn,Coor,keep,ROIvars);
63+
options = GUIout{2};
64+
keep = GUIout{3};
65+
end
66+
67+
%% re-estimate temporal components
5168

52-
[A_or,C_or,S_or,P] = order_ROIs(A,C,S,P); % order components
69+
A_keep = A(:,keep);
70+
C_keep = C(keep,:);
71+
options.p = 2; % perform deconvolution
72+
[C2,f2,P2,S2,YrA2] = update_temporal_components_fast(data,A_keep,b,C_keep,f_keep,P,options);
5373

54-
contour_threshold = 0.95; % amount of energy used for each component to construct contour plot
55-
figure;
56-
[Coor,json_file] = plot_contours(A_or,reshape(P.sn,sizY(1),sizY(2)),contour_threshold,1); % contour plot of spatial footprints
57-
%savejson('jmesh',json_file,'filename'); % optional save json file with component coordinates (requires matlab json library)
74+
%% plot results
75+
plot_components_GUI(data,A_keep,C2,b,f2,Cn,options);

demo_script_class.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
clear;
22
% same demo as demo_script.m but using the class @Sources2D
3+
% (possibly outdated at the moment)
34
%% load file
45

56
addpath(genpath('utilities'));

0 commit comments

Comments
 (0)