Predict the signal in a single voxel given the fiber going through the voxel. voxDSig = feComputeVoxelSignal(fe,voxelIndex) Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com.
0001 function voxDSig = feComputeVoxelSignal(fe,voxIndex) 0002 % Predict the signal in a single voxel given the fiber going through the 0003 % voxel. 0004 % 0005 % voxDSig = feComputeVoxelSignal(fe,voxelIndex) 0006 % 0007 % Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com. 0008 0009 % Extract information regarding, voxels, signal and fibers. 0010 S0 = feGet(fe,'b0signalimage', voxIndex); % non diffusion-weighted signal 0011 bvecs = feGet(fe,'bvecs'); % bvecs 0012 bvals = feGet(fe,'bvals'); % bvals 0013 tot_fibers_num = feGet(fe,'tot f num', voxIndex); % number of total fibers in the voxel 0014 unique_fibers_num = feGet(fe,'unique f num', voxIndex); % number of unique fibers in the voxel 0015 tot_fiber_index = cell2mat(feGet(fe,'totf', voxIndex)); % indexes to the total fibers in the voxels 0016 unique_fiber_index= cell2mat(feGet(fe,'uniquef',voxIndex)); % indexes to the unique fibers in the voxels 0017 voxTensors = feGet(fe,'voxeltensors', voxIndex); % Get the tensors for each node in each fiber 0018 % going through this voxel 0019 0020 % Compute the predicted signal by each tensors of each node in this voxel. 0021 voxDSig = feComputeSignal(S0, bvecs, bvals, voxTensors); 0022 0023 % Combine the diffusion predictions across nodes of a single fiber. 0024 % Use only the prediction from the unique fibers, not from all the fibers. 0025 if tot_fibers_num ~= unique_fibers_num 0026 combineM = zeros(tot_fibers_num, unique_fibers_num); 0027 0028 % The matrix combineM is a set of 0s and 1s that will sum together the 0029 % nodes from a single fiber. 0030 for ii=1:unique_fibers_num 0031 combineM(:,ii) = ( tot_fiber_index == unique_fiber_index(ii) ); 0032 end 0033 0034 % The matrix for this voxel starts with each node, and when we multiply 0035 % by combineM. The resulting matrix represents each fiber 0036 % (not each node) as a column 0037 voxDSig = voxDSig*combineM; 0038 end 0039 0040 return