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
+
1
5
clear ;
2
6
%% load file
3
7
47
51
48
52
[A ,b ,C ,f ,S ,P ,RESULTS ,YrA ] = run_CNMF_patches(data ,K ,patches ,tau ,p ,options );
49
53
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
51
68
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 );
53
73
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 );
0 commit comments