Deletes a set of fibers from the signal and the M matrix. fe = feConnectomeSelectFibers(fe,fibersToKeep,[recomputeFibersInfo=0]) The connectome select process builds the parameters inside of fe.life for a selected set of fibers. The parameters inside of fe.life that are modified are The M matrix The fe.life.fibers entries We store and keep the whole connectome in .fg. But not all calculations with the M matrix use all the fibers. In some cases we run smaller subsets. Inputs: fe - an fe structure, see feCreate.m, and v_lifeExample.m fibersToKeep - a list of indexes to the fibers to keep e.g., [1 10 100]. recomputeFibersInfo - recomputes the fibers' info this takes a long time. So the default is not to recompute (0). Example: fibersToKeep = 1:50; feConnectomeSelectFibers(fe, fibersToKeep) See also: fgExtract Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com.
0001 function fe = feConnectomeSelectFibers(fe, fibersToKeep,recomputeFibersInfo) 0002 % Deletes a set of fibers from the signal and the M matrix. 0003 % 0004 % fe = feConnectomeSelectFibers(fe,fibersToKeep,[recomputeFibersInfo=0]) 0005 % 0006 % The connectome select process builds the parameters inside of fe.life for 0007 % a selected set of fibers. The parameters inside of fe.life that are 0008 % modified are 0009 % 0010 % The M matrix 0011 % The fe.life.fibers entries 0012 % 0013 % We store and keep the whole connectome in .fg. But not all calculations 0014 % with the M matrix use all the fibers. In some cases we run smaller 0015 % subsets. 0016 % 0017 % Inputs: 0018 % fe - an fe structure, see feCreate.m, and v_lifeExample.m 0019 % fibersToKeep - a list of indexes to the fibers to keep e.g., [1 10 100]. 0020 % recomputeFibersInfo - recomputes the fibers' info this takes a long time. 0021 % So the default is not to recompute (0). 0022 % 0023 % Example: 0024 % fibersToKeep = 1:50; 0025 % feConnectomeSelectFibers(fe, fibersToKeep) 0026 % 0027 % See also: fgExtract 0028 % 0029 % Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com. 0030 0031 if notDefined('recomputeFibersInfo'),recomputeFibersInfo=0;end 0032 fprintf('[%s], Selecting fibers from the full Connectome...\n',mfilename) 0033 0034 % Change the name of the fe structure 0035 indx = strfind(feGet(fe,'name'),'-'); 0036 feFileName = feGet(fe,'name'); 0037 if ~isempty(indx) 0038 feFileName = feFileName((indx(end) + 1):end); % Strip away any previous date-string tag. 0039 end 0040 feFileName = sprintf('%s-%s', datestr(now,30),feFileName); 0041 fe = feSet(fe, 'name',feFileName); 0042 0043 % Delete fibers' columns from the model. 0044 fe = feSet(fe,'Mfiber',feGet(fe,'mkeepfibers',fibersToKeep)); 0045 0046 % Remove the fibers from the fiber group: 0047 fe = feSet(fe,'fg',feGet(fe,'fiberssubset',fibersToKeep)); 0048 0049 % Take care of the field fe.life.fibers 0050 % Set the subset of tensors, the one only for the left-over fibers 0051 if ~isempty(fe.life.fibers.tensors) 0052 fe = feSet(fe,'tensors',feGet(fe,'tensors',fibersToKeep)); 0053 end 0054 0055 % Remove any fit or cross-validation 0056 fe = feSet(fe,'fit', []); 0057 fe = feSet(fe,'xvalfit',[]); 0058 0059 % By default we do not recompute the fibers info. 0060 if recomputeFibersInfo 0061 % We disregard fibers that have identical trajectories within the ROI. 0062 roi = feGet(fe,'roi coords'); 0063 fe = feSet(fe,'voxel 2 fiber node pairs',fefgGet(feGet(fe,'fg'),'v2fn',roi)); 0064 fe = feGetConnectomeInfo(fe); 0065 else 0066 % this is done automatically by feSet: 0067 % fe = feSet(fe,'voxel 2 fiber node pairs',[]); 0068 fe = feSet(fe,'index to unique fibers in each voxel',[]); 0069 fe = feSet(fe,'number of unique fibers in each voxel', []); 0070 fe = feSet(fe,'number of total fibers in each voxel', []); 0071 fe = feSet(fe,'index of total fibers in each voxel', []); 0072 end 0073 0074 return 0075