Home > fmri > fsl > get_stable_sets.m

get_stable_sets

PURPOSE ^

ss = get_stable_sets(cdata, scs)

SYNOPSIS ^

function ss = get_stable_sets(cdata, scs)

DESCRIPTION ^

 ss = get_stable_sets(cdata, scs)

 Returns sets of components that belong together.

 Figures out all of the conjunction chains working through the cdata
 matrices.  

 scs - stable components in each session

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ss = get_stable_sets(cdata, scs)
0002 % ss = get_stable_sets(cdata, scs)
0003 %
0004 % Returns sets of components that belong together.
0005 %
0006 % Figures out all of the conjunction chains working through the cdata
0007 % matrices.
0008 %
0009 % scs - stable components in each session
0010 %
0011 
0012 % 10/19/05 Petr Janata - extracted from earlier script
0013 
0014 nsess = length(scs);
0015 
0016 stable_ics = find(scs{1});
0017 nstable = length(stable_ics);
0018 
0019 ss = {};
0020 for istable = 1:nstable
0021   start_ic_idx = stable_ics(istable);
0022   fprintf('Conjoining ICs starting with session 1 IC %d\n', start_ic_idx);
0023 
0024   curr_ic_idx = start_ic_idx;
0025 
0026   curr_chain_idx = 1;
0027   ss{istable} = [];
0028   ss{istable}(1,:) = [1 curr_ic_idx];
0029   for isess = 1:nsess
0030     jsess = mod(isess,nsess)+1;
0031     tmp = cdata{isess,jsess}(curr_ic_idx,:)' .* repmat(scs{jsess},1,length(curr_ic_idx));
0032     curr_ic_idx = find(any(tmp,2));
0033     nic = length(curr_ic_idx);
0034     if nic
0035       start_idx = size(ss{istable},1)+1;
0036       stop_idx = start_idx+nic-1;
0037       ss{istable}(start_idx:stop_idx,:) = [ones(nic,1)*jsess,curr_ic_idx(:)];
0038     else
0039       break
0040     end
0041   end % for isess
0042   
0043   % Now get the unique ICs
0044   ss{istable} = unique(ss{istable},'rows');
0045   
0046 end % for istable

Generated on Thu 23-May-2019 04:00:50 by m2html © 2003