Skip to content

Commit

Permalink
updated demos
Browse files Browse the repository at this point in the history
  • Loading branch information
epnev committed Feb 8, 2017
1 parent f8dc452 commit da46929
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
30 changes: 24 additions & 6 deletions demo_memmap.m
@@ -1,3 +1,7 @@
% demo script for splitting the field of view in patches and processing in parallel
% through memory mapping. See also run_pipeline.m for the complete
% pre-processing pipeline of large datasets

clear;
%% load file

Expand Down Expand Up @@ -47,11 +51,25 @@

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

%% order and plot
%% classify components
[ROIvars.rval_space,ROIvars.rval_time,ROIvars.max_pr,ROIvars.sizeA,keep] = classify_components(data,A,C,b,f,YrA,options);

%% run GUI for modifying component selection (optional, close twice to save values)
Cn = reshape(P.sn,sizY(1),sizY(2)); % background image for plotting
run_GUI = false;
if run_GUI
Coor = plot_contours(A,Cn,options,1); close;
GUIout = ROI_GUI(A,options,Cn,Coor,keep,ROIvars);
options = GUIout{2};
keep = GUIout{3};
end

%% re-estimate temporal components

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

contour_threshold = 0.95; % amount of energy used for each component to construct contour plot
figure;
[Coor,json_file] = plot_contours(A_or,reshape(P.sn,sizY(1),sizY(2)),contour_threshold,1); % contour plot of spatial footprints
%savejson('jmesh',json_file,'filename'); % optional save json file with component coordinates (requires matlab json library)
%% plot results
plot_components_GUI(data,A_keep,C2,b,f2,Cn,options);
1 change: 1 addition & 0 deletions demo_script_class.m
@@ -1,5 +1,6 @@
clear;
% same demo as demo_script.m but using the class @Sources2D
% (possibly outdated at the moment)
%% load file

addpath(genpath('utilities'));
Expand Down

0 comments on commit da46929

Please sign in to comment.