function varargout = pm_create_connectogram(rima,pm) % Create vectors corresponding to a connectogram based on label-map. % FORMAT [ii,jj,nn,pp] = pm_create_connectogram(rima,pm) % or % FORMAT [N,P] = pm_create_connectogram(rima,pm) % % Input: % rima : Label map consisting of connected regions indentified % by unique labels. % pm : Phasemap. % % Output: % EITHER % ii : Array of row indicies. % jj : Array of column indicies. % nn : Array of no. of voxels in borders between regions. % So e.g. if ii[10]=5, jj[10]=9 and nn[10]=123 it % means that regions 5 and 9 have a common border % (are connected) and that this border has 123 voxels. % pp : Array of sum of phase differences between regions. % So e.g. if ii[10]=5, jj[10]=9 and pp[10]=770.2 it % means that regions 5 and 9 have a common border % (are connected) and that for paired voxels across % this border the sum of phase differenes is 770.2. % N.B. the subtraction is phi(ii(i))-phi(jj(i)), % which in the example above means that the phase is % smaller in region 9 than in region 5. % % OR % % N : Sparse matrix where N(i,j) for i