Skip to content

Commit

Permalink
updated demo
Browse files Browse the repository at this point in the history
  • Loading branch information
epnev committed Nov 7, 2017
1 parent 60542b4 commit 77c1f96
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
18 changes: 16 additions & 2 deletions demo_script.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,23 @@
[C,f,P,S,YrA] = update_temporal_components(Yr,A,b,Cin,fin,P,options);

%% classify components

[ROIvars.rval_space,ROIvars.rval_time,ROIvars.max_pr,ROIvars.sizeA,keep] = classify_components(Y,A,C,b,f,YrA,options);
A_keep = A(:,keep);
C_keep = C(keep,:);

%% further classification with cnn_classifier
try % matlab 2017b or later is needed
[ind,value] = cnn_classifier(A,[d1,d2],'cnn_model',0.2);
catch
ind = true(size(A,2),1);
end
%% display kept and discarded components
A_keep = A(:,(keep & ind));
C_keep = C((keep & ind),:);
figure;
subplot(121); montage(extract_patch(A(:,(keep & ind)),[d1,d2],[30,30]),'DisplayRange',[0,0.15]);
title('Kept Components');
subplot(122); montage(extract_patch(A(:,~(keep & ind)),[d1,d2],[30,30]),'DisplayRange',[0,0.15])
title('Discarded Components');
%% merge found components
[Am,Cm,K_m,merged_ROIs,Pm,Sm] = merge_components(Yr,A_keep,b,C_keep,f,P,S,options);

Expand Down
1 change: 1 addition & 0 deletions utilities/extract_patch.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
nd = length(dims);
if nd == 2; dims(3) = 1; patch_size(3) = 1; end
K = size(A,2);
A = A/spdiags(sqrt(sum(A.^2,1))'+eps,0,K,K); % normalize to sum 1 for each compoennt
cm = com(A,dims(1),dims(2),dims(3));
xx = -ceil(patch_size(1)/2-1):floor(patch_size(1)/2);
yy = -ceil(patch_size(2)/2-1):floor(patch_size(2)/2);
Expand Down

0 comments on commit 77c1f96

Please sign in to comment.