function Pairs = call_plex(square) % function Pairs = call_plex(square) % Author - Deepti Pachauri % Department of Computer Sciences % University of Wisconsin - Madison % Construct persistent homology given flat map of signal (square). % INPUT - % square - flat map of cortical signal. % Output - % Pairs - Persistent homology in degree 0 stored as cell array. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % addpath where Plex is installed. For example % addpath(genpath('/home/Plex/plex-2.5')); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Pairs = cell(1,1); [lmax, lmin] = figure_extrema(square); X = [lmin.J; lmax.J]; Y = [lmin.I; lmax.I]; tri = delaunay(X,Y); C = attach(plex,tri'); figure, imagesc(square) hold on plot(X,Y,'k+') figure, plot3complex(C,[X,Y]') %filtration specification for persistence f = [lmin.value lmax.value]; filtrationDirection = 1; F = {filtrationDirection * f}; F1 = extend(C, F); F1(1,4) = {[]}; disp('calculating persistence...\n') I = persistence(C, F1); % calculate the persistent homology Pairs{1,1} = I{1,1};