Home > compute > feGetConnectomeInfo.m

feGetConnectomeInfo

PURPOSE ^

Find the unique fibers in a connectome.

SYNOPSIS ^

function fe = feGetConnectomeInfo(fe)

DESCRIPTION ^

 Find the unique fibers in a connectome.
 
   unique_fibers_index = feGetConnectomeInfo(fe)

 We identify the fibers that have identical trajectories (that pass
 through exactly the same voxels) within the ROI. These are stored in the
 fe slot 'unique index'.


 Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function fe = feGetConnectomeInfo(fe)
0002 % Find the unique fibers in a connectome.
0003 %
0004 %   unique_fibers_index = feGetConnectomeInfo(fe)
0005 %
0006 % We identify the fibers that have identical trajectories (that pass
0007 % through exactly the same voxels) within the ROI. These are stored in the
0008 % fe slot 'unique index'.
0009 %
0010 %
0011 % Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com.
0012 
0013 % Get the indexes to the voxels actually used to build LifE.
0014 % Remember that voxels with no fibers are disregarded during the build.
0015 usedVoxels = feGet(fe,'usedVoxels');
0016 nVoxels    = length(usedVoxels);
0017 
0018 % preallocate memory for speed.
0019 f                  = cell( nVoxels,1); % This will contain all the fibers in each voxel
0020 unique_fibers_index= cell( nVoxels,1); % This will contain the *unique* fibers in each voxel
0021 unique_fibers_num  = zeros(nVoxels,1); % This will contain the number of unique fibers in each voxel
0022 
0023 % Get the fibers and unique fibers from voxel2FNpairs, in each voxel:
0024 parfor vv = 1:nVoxels
0025   % This is the index of the voxel used, it is used to address voxel2FNpair
0026   voxIndex = usedVoxels(vv);
0027   
0028   % Indexes to the fibers in the current voxel
0029   f{vv} = fe.life.voxel2FNpair{voxIndex}(:,1);
0030   
0031   % Reduce to the unique fibers:
0032   unique_fibers_index{vv} = sort(unique(f{vv}));
0033   unique_fibers_num(vv)   = length(unique_fibers_index{vv});
0034 end
0035 
0036 tot_fibers_num = cellfun(@length,f);
0037 
0038 % Set them in the fe structure:
0039 % Indexes to the unique fibers going through each voxel
0040 fe = feSet(fe,'index to unique fibers in each voxel',  unique_fibers_index);
0041 % Number of unique fibers going through each voxel
0042 fe = feSet(fe,'number of unique fibers in each voxel', unique_fibers_num);
0043 
0044 % Number of total fibers going trhough each voxel
0045 fe = feSet(fe,'number of total fibers in each voxel',  tot_fibers_num);
0046 % Indexes to the total fibers going through each voxel
0047 fe = feSet(fe,'index of total fibers in each voxel',   f);
0048 
0049 return

Generated on Wed 02-Jul-2014 17:17:39 by m2html © 2005