Get function for fascicle evaluation structure, to use for a repeated measure calculation. This function is similar to feGet but uses the repeted dataset to compute the DWI signal and all the calculations that depend on the DWI signal will be different. Importantly, this function will use calls to feGet every time we compute values that depend on the LiFE model or fit. This function allows for computing measures of: (1) data reliability and (2) model versus data reliability val = feGetRep(fe,param,varargin) INPUTS: Coords - Nx3 set of coordinates in image space voxelIndices - Vector of 1's and 0's, there is a one for each location the the connectome coordinates for which there is a match in the coords Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com. ---------- List of arguments ---- Name of the current fe structure. name = feGetRep(fe,'name') ---------- The type of objes (always, fascicle evaluation) type = feGetRep(fe,'type') ---------- Load the repeated-measure diffusion weighted data. dwi = feGetRep(fe,'dwirepeat') ---------- Load the repeated measure of the diffusion weighted data. dwiFile = feGetRep(fe,'dwirepeatfile') ---------- Directory where the LiFe structes are saved by defualt. sdir = feGetRep(fe,'savedir'); ---------- Diffusion directions. val = feGetRep(fe,'bvecs'); ---------- Indices to the diffusion directions in the DWi 4th Dimension. val = feGetRep(fe,'bvecs indices'); ---------- Number of B0's val = feGetRep(fe,'n bvals'); ---------- B0 Values. bval = feGetRep(fe,'bvals') ---------- Returns a nVoxels X nBvecs array of measured diffusion signal val = feGetRep(fe,'dsiinvox'); val = feGetRep(fe,'dsiinvox',voxelsIndices); val = feGetRep(fe,'dsiinvox',coords); ---------- Returns a nVoxels X nBvecs array of demeaned diffusion signal val =feGetRep(fe,'dsiinvoxdemeaned'); val =feGetRep(fe,'dsiinvoxdemeaned',voxelsIndices); val =feGetRep(fe,'dsiinvoxdemeaned',coords); ---------- Get the diffusion signal at 0 diffusion weighting (B0) for this voxel val = feGetRep(fe,'b0signalimage'); val = feGetRep(fe,'b0signalimage',voxelIndex); val = feGetRep(fe,'b0signalimage',coords); ---------- Weights of the isotropic voxel signals, this is the mean signal in each voxel. val = feGetRep(fe,'iso weights'); val = feGetRep(fe,'iso weights'coords) val = feGetRep(fe,'iso weights',voxelIndices) ---------- Measured signal in VOI, this is the raw signal. not demeaned dSig = feGetRep(fe,'dSig full') --------- Measured signal in VOI, demeaned, this is the signal used for the fiber-portion of the M model. dSig = feGetRep(fe,'dsigdemeaned'); dSig = feGetRep(fe,'dsigdemeaned',[1 10 100]); dSig = feGetRep(fe,'dsigdemeaned',coords); --------- Get the demeaned signal for a subset of rows. Useful for cross-validation. dSig = feGetRep(fe,'dsigrowssubset',voxelsList); --------- Return the global R2 (fraction of variance explained) of the full life model. R2 = feGetRep(fe,'total r2'); --------- Percent variance explained R2 = feGetRep(fe,'explained variance') --------- Root mean squared error of the LiFE fit to the whole data rmse = feGetRep(fe,'rmse') --------- Residual signal: (fiber prediction - measured_demeaned). res = feGetRep(fe,'res sig fiber') --------- Residual signal: (full model prediction - measured signal). res = feGetRep(fe,'res sig full'); --------- Residual signal: (fiber model prediction - demeaned measured signal) with added mean signal. Res is returned as a vector. This is used to reconstruct an image (volume) to be used for the refinement process. res = feGetRep(fe,'fiber res sig with mean'); res = feGetRep(fe,'fiber res sig with mean',coords); res = feGetRep(fe,'fiber res sig with mean',voxelIndices); --------- Residual signal fiber model prediction - demeaned measured signal with added mean signal. Res is returned as an array (nBvecs x nVoxel). This is used to reconstruct an image (volume) to be used for the refinement process. res = feGetRep(fe,'fiber res sig with mean voxel'); res = feGetRep(fe,'fiber res sig with mean voxel',coords); res = feGetRep(fe,'fiber res sig with mean voxel',voxelIndices); --------- Return a column vector of the proportion of variance explained in each voxel. R2byVox = feGetRep(fe,'voxr2'); R2byVox = feGetRep(fe,'voxr2',coords); --------- Return a column vector of the proportion of variance explained in each voxel. (Normalized to the squared mean diffusion signal in each voxel) R2byVox = feGetRep(fe,'voxr2zero'); R2byVox = feGetRep(fe,'voxr2zero',coords); --------- Return the percent of varince explained in each voxel. R2byVox = feGetRep(fe,'var exp by voxel'); R2byVox = feGetRep(fe,'var exp by voxel',coords); --------- Demeaned diffusion signal in each voxel. dSigByVoxel = feGetRep(fe,'dsigdemeaned by Voxel'); dSigByVoxel = feGetRep(fe,'dsigdemeaned by Voxel',coords); dSigByVoxel = feGetRep(fe,'dsigdemeaned by Voxel',vxIndex); --------- Full (measured) signal in each voxel. dSigByVoxel = feGetRep(fe,'dSig full by Voxel'); dSigByVoxel = feGetRep(fe,'dSig full by Voxel',coords); dSigByVoxel = feGetRep(fe,'dSig full by Voxel',vxIndex); --------- Predicted signal by the full model in a set of voxeles. pSigByVoxel = feGetRep(fe, 'pSig full by voxel'); pSigByVoxel = feGetRep(fe, 'pSig full by voxel',coords); pSigByVoxel = feGetRep(fe, 'pSig full by voxel',voxelIndex); --------- A volume of RMSE values. RMSE = feGetRep(fe,'vox rmse') RMSE = feGetRep(fe,'vox rmse',coords) RMSE = feGetRep(fe,'vox rmse',vxIndex) --------- A volume of RMSE values with a subset of fibers' weights set to 0. RMSE = feGetRep(fe,'vox rmse',fiberIndices) RMSE = feGetRep(fe,'vox rmse',fiberIndices,coords) RMSE = feGetRep(fe,'vox rmse',fiberIndices,voxelIndex) --------- Fibers' residual signal by voxel. res = feGetRep(fe,'res sig fiber vox') res = feGetRep(fe,'res sig fiber vox',coords) res = feGetRep(fe,'res sig fiber vox',vxIndex) --------- Full (measured) residual signal by voxel. res = feGetRep(fe,'res sig full vox') res = feGetRep(fe,'res sig full vox',coords) res = feGetRep(fe,'res sig full vox',vxIndex) --------- Fibers' residual signal by voxel with mean signal added (with added isotropic component). This is used to compute the residual signal for the refinement. res = feGetRep(fe,'fiber res sig with mean vox') res = feGetRep(fe,'fiber res sig with mean vox',coords) res = feGetRep(fe,'fiber res sig with mean vox',vxIndex) --------- Residual signal full model prediction from a multi-voxel fit. res = feGetRep(fe,'res sig full voxfit'); res = feGetRep(fe, 'res sig full voxfit',coords); res = feGetRep(fe, 'res sig full voxfit',voxelIndex); --------- Dimensions of the DW volume. dim = feGetRep(fe,'dims') --------- Dimensions of the maps of parameters and results. dims = feGetRep(fe, 'mapsize') End of feGetRep.m parameters, Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com.
0001 function val = feGetRep(fe,param,varargin) 0002 % Get function for fascicle evaluation structure, to use for a repeated 0003 % measure calculation. 0004 % 0005 % This function is similar to feGet but uses the repeted dataset to compute 0006 % the DWI signal and all the calculations that depend on the DWI signal 0007 % will be different. 0008 % 0009 % Importantly, this function will use calls to feGet every time we compute 0010 % values that depend on the LiFE model or fit. 0011 % 0012 % This function allows for computing measures of: 0013 % (1) data reliability and 0014 % (2) model versus data reliability 0015 % 0016 % val = feGetRep(fe,param,varargin) 0017 % 0018 % INPUTS: 0019 % Coords - Nx3 set of coordinates in image space 0020 % voxelIndices - Vector of 1's and 0's, there is a one for each 0021 % location the the connectome coordinates for which there is 0022 % a match in the coords 0023 % 0024 % 0025 % 0026 % Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com. 0027 % 0028 %---------- List of arguments ---- 0029 % Name of the current fe structure. 0030 % name = feGetRep(fe,'name') 0031 %---------- 0032 % The type of objes (always, fascicle evaluation) 0033 % type = feGetRep(fe,'type') 0034 %---------- 0035 % Load the repeated-measure diffusion weighted data. 0036 % dwi = feGetRep(fe,'dwirepeat') 0037 %---------- 0038 % Load the repeated measure of the diffusion weighted data. 0039 % dwiFile = feGetRep(fe,'dwirepeatfile') 0040 %---------- 0041 % Directory where the LiFe structes are saved by defualt. 0042 % sdir = feGetRep(fe,'savedir'); 0043 %---------- 0044 % Diffusion directions. 0045 % val = feGetRep(fe,'bvecs'); 0046 %---------- 0047 % Indices to the diffusion directions in the DWi 4th Dimension. 0048 % val = feGetRep(fe,'bvecs indices'); 0049 %---------- 0050 % Number of B0's 0051 % val = feGetRep(fe,'n bvals'); 0052 %---------- 0053 % B0 Values. 0054 % bval = feGetRep(fe,'bvals') 0055 %---------- 0056 % Returns a nVoxels X nBvecs array of measured diffusion signal 0057 % val = feGetRep(fe,'dsiinvox'); 0058 % val = feGetRep(fe,'dsiinvox',voxelsIndices); 0059 % val = feGetRep(fe,'dsiinvox',coords); 0060 %---------- 0061 % Returns a nVoxels X nBvecs array of demeaned diffusion signal 0062 % val =feGetRep(fe,'dsiinvoxdemeaned'); 0063 % val =feGetRep(fe,'dsiinvoxdemeaned',voxelsIndices); 0064 % val =feGetRep(fe,'dsiinvoxdemeaned',coords); 0065 %---------- 0066 % Get the diffusion signal at 0 diffusion weighting (B0) for this voxel 0067 % val = feGetRep(fe,'b0signalimage'); 0068 % val = feGetRep(fe,'b0signalimage',voxelIndex); 0069 % val = feGetRep(fe,'b0signalimage',coords); 0070 %---------- 0071 % Weights of the isotropic voxel signals, this is the mean signal in 0072 % each voxel. 0073 % val = feGetRep(fe,'iso weights'); 0074 % val = feGetRep(fe,'iso weights'coords) 0075 % val = feGetRep(fe,'iso weights',voxelIndices) 0076 %---------- 0077 % Measured signal in VOI, this is the raw signal. not demeaned 0078 % 0079 % dSig = feGetRep(fe,'dSig full') 0080 %--------- 0081 % Measured signal in VOI, demeaned, this is the signal used for the 0082 % fiber-portion of the M model. 0083 % 0084 % dSig = feGetRep(fe,'dsigdemeaned'); 0085 % dSig = feGetRep(fe,'dsigdemeaned',[1 10 100]); 0086 % dSig = feGetRep(fe,'dsigdemeaned',coords); 0087 %--------- 0088 % Get the demeaned signal for a subset of rows. 0089 % Useful for cross-validation. 0090 % dSig = feGetRep(fe,'dsigrowssubset',voxelsList); 0091 %--------- 0092 % Return the global R2 (fraction of variance explained) of the full life 0093 % model. 0094 % R2 = feGetRep(fe,'total r2'); 0095 %--------- 0096 % Percent variance explained 0097 % R2 = feGetRep(fe,'explained variance') 0098 %--------- 0099 % Root mean squared error of the LiFE fit to the whole data 0100 % rmse = feGetRep(fe,'rmse') 0101 %--------- 0102 % Residual signal: (fiber prediction - measured_demeaned). 0103 % res = feGetRep(fe,'res sig fiber') 0104 %--------- 0105 % Residual signal: (full model prediction - measured signal). 0106 % res = feGetRep(fe,'res sig full'); 0107 %--------- 0108 % Residual signal: (fiber model prediction - demeaned measured signal) 0109 % with added mean signal. Res is returned as a vector. 0110 % This is used to reconstruct an image (volume) to be used for the 0111 % refinement process. 0112 % res = feGetRep(fe,'fiber res sig with mean'); 0113 % res = feGetRep(fe,'fiber res sig with mean',coords); 0114 % res = feGetRep(fe,'fiber res sig with mean',voxelIndices); 0115 %--------- 0116 % Residual signal fiber model prediction - demeaned measured signal 0117 % with added mean signal. Res is returned as an array (nBvecs x nVoxel). 0118 % This is used to reconstruct an image (volume) to be used for the 0119 % refinement process. 0120 % res = feGetRep(fe,'fiber res sig with mean voxel'); 0121 % res = feGetRep(fe,'fiber res sig with mean voxel',coords); 0122 % res = feGetRep(fe,'fiber res sig with mean voxel',voxelIndices); 0123 %--------- 0124 % Return a column vector of the proportion of variance explained in 0125 % each voxel. 0126 % R2byVox = feGetRep(fe,'voxr2'); 0127 % R2byVox = feGetRep(fe,'voxr2',coords); 0128 %--------- 0129 % Return a column vector of the proportion of variance explained in 0130 % each voxel. (Normalized to the squared mean diffusion signal in each voxel) 0131 % R2byVox = feGetRep(fe,'voxr2zero'); 0132 % R2byVox = feGetRep(fe,'voxr2zero',coords); 0133 %--------- 0134 % Return the percent of varince explained in each voxel. 0135 % R2byVox = feGetRep(fe,'var exp by voxel'); 0136 % R2byVox = feGetRep(fe,'var exp by voxel',coords); 0137 %--------- 0138 % Demeaned diffusion signal in each voxel. 0139 % dSigByVoxel = feGetRep(fe,'dsigdemeaned by Voxel'); 0140 % dSigByVoxel = feGetRep(fe,'dsigdemeaned by Voxel',coords); 0141 % dSigByVoxel = feGetRep(fe,'dsigdemeaned by Voxel',vxIndex); 0142 %--------- 0143 % Full (measured) signal in each voxel. 0144 % dSigByVoxel = feGetRep(fe,'dSig full by Voxel'); 0145 % dSigByVoxel = feGetRep(fe,'dSig full by Voxel',coords); 0146 % dSigByVoxel = feGetRep(fe,'dSig full by Voxel',vxIndex); 0147 %--------- 0148 % Predicted signal by the full model in a set of voxeles. 0149 % pSigByVoxel = feGetRep(fe, 'pSig full by voxel'); 0150 % pSigByVoxel = feGetRep(fe, 'pSig full by voxel',coords); 0151 % pSigByVoxel = feGetRep(fe, 'pSig full by voxel',voxelIndex); 0152 %--------- 0153 % A volume of RMSE values. 0154 % RMSE = feGetRep(fe,'vox rmse') 0155 % RMSE = feGetRep(fe,'vox rmse',coords) 0156 % RMSE = feGetRep(fe,'vox rmse',vxIndex) 0157 %--------- 0158 % A volume of RMSE values with a subset of fibers' weights set to 0. 0159 % RMSE = feGetRep(fe,'vox rmse',fiberIndices) 0160 % RMSE = feGetRep(fe,'vox rmse',fiberIndices,coords) 0161 % RMSE = feGetRep(fe,'vox rmse',fiberIndices,voxelIndex) 0162 %--------- 0163 % Fibers' residual signal by voxel. 0164 % res = feGetRep(fe,'res sig fiber vox') 0165 % res = feGetRep(fe,'res sig fiber vox',coords) 0166 % res = feGetRep(fe,'res sig fiber vox',vxIndex) 0167 %--------- 0168 % Full (measured) residual signal by voxel. 0169 % res = feGetRep(fe,'res sig full vox') 0170 % res = feGetRep(fe,'res sig full vox',coords) 0171 % res = feGetRep(fe,'res sig full vox',vxIndex) 0172 %--------- 0173 % Fibers' residual signal by voxel with mean signal added (with added 0174 % isotropic component). 0175 % This is used to compute the residual signal for the refinement. 0176 % res = feGetRep(fe,'fiber res sig with mean vox') 0177 % res = feGetRep(fe,'fiber res sig with mean vox',coords) 0178 % res = feGetRep(fe,'fiber res sig with mean vox',vxIndex) 0179 %--------- 0180 % Residual signal full model prediction from a multi-voxel fit. 0181 % res = feGetRep(fe,'res sig full voxfit'); 0182 % res = feGetRep(fe, 'res sig full voxfit',coords); 0183 % res = feGetRep(fe, 'res sig full voxfit',voxelIndex); 0184 %--------- 0185 % Dimensions of the DW volume. 0186 % dim = feGetRep(fe,'dims') 0187 %--------- 0188 % Dimensions of the maps of parameters and results. 0189 % dims = feGetRep(fe, 'mapsize') 0190 % 0191 % End of feGetRep.m parameters, 0192 % 0193 % 0194 % Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com. 0195 0196 val = []; 0197 0198 % Format the input parameters. 0199 param = lower(strrep(param,' ','')); 0200 0201 % Start sorting the input and computing the output. 0202 switch param 0203 case 'name' 0204 % Name of the current fe structure. 0205 % 0206 % name = feGetRep(fe,'name') 0207 val = fe.rep.name; 0208 0209 case 'type' 0210 % The type of objes (always, fascicle evaluation) 0211 % 0212 % type = feGetRep(fe,'type') 0213 val = fe.rep.type; % Always fascicle evaluation 0214 0215 case 'dwi' 0216 % Load the diffusion weighted data. 0217 % 0218 % dwi = feGetRep(fe,'dwirepeat') 0219 val = dwiLoad(feGetRep(fe,'dwifile')); 0220 0221 case 'dwifile' 0222 % Load the repeated measure of the diffusion weighted data. 0223 % 0224 % dwiFile = feGetRep(fe,'dwirepeatfile') 0225 val = fe.path.dwifilerep; 0226 0227 case {'bvecs'} 0228 % Diffusion directions. 0229 % 0230 % val = feGetRep(fe,'bvecs'); 0231 val = fe.rep.bvecs; 0232 0233 case {'bvecsindices'} 0234 % Indices to the diffusion directions in the DWi 4th Dimension. 0235 % 0236 % val = feGetRep(fe,'bvecs indices rep'); 0237 val = fe.rep.bvecsindices; 0238 0239 case {'nbvecs','nbvals'} 0240 % Number of B0's 0241 % 0242 % val = feGetRep(fe,'n bvals'); 0243 val = length(feGetRep(fe,'bvals')); 0244 0245 case {'bvals'} 0246 % B0 Values. 0247 % 0248 % bval = feGetRep(fe,'bvals') 0249 val = fe.rep.bvals; 0250 0251 case {'diffusionsignalinvoxel','dsiinvox','dsigvox','dsigmeasuredvoxel'} 0252 % Returns a nVoxels X nBvecs array of measured diffusion signal 0253 % 0254 % val = feGetRep(fe,'dsiinvox'); 0255 % val = feGetRep(fe,'dsiinvox',voxelsIndices); 0256 % val = feGetRep(fe,'dsiinvox',coords); 0257 val = fe.rep.diffusion_signal_img(feGet(fe,'voxelsindices',varargin),:)'; 0258 0259 case {'diffusionsignalinvoxeldemeaned','dsiinvoxdemeaned'} 0260 % Returns a nVoxels X nBvecs array of demeaned diffusion signal 0261 % 0262 % val =feGetRep(fe,'dsiinvoxdemeaned'); 0263 % val =feGetRep(fe,'dsiinvoxdemeaned',voxelsIndices); 0264 % val =feGetRep(fe,'dsiinvoxdemeaned',coords); 0265 nBvecs = feGetRep(fe,'nBvecs'); 0266 voxelIndices = feGet(fe,'voxelsindices',varargin); 0267 val = fe.rep.diffusion_signal_img(voxelIndices,:) - repmat(mean(fe.rep.diffusion_signal_img(voxelIndices,:), 2),1,nBvecs); 0268 keyboard % THis seems to be worng 0269 0270 case {'b0signalimage','b0vox'} 0271 % Get the diffusion signal at 0 diffusion weighting (B0) for this voxel 0272 % 0273 % val = feGetRep(fe,'b0signalimage'); 0274 % val = feGetRep(fe,'b0signalimage',voxelIndex); 0275 % val = feGetRep(fe,'b0signalimage',coords); 0276 val = fe.rep.diffusion_S0_img(feGet(fe,'voxelsindices',varargin), :); 0277 0278 case {'isoweights','weightsiso','meanvoxelsignal'} 0279 % Weights of the isotropic voxel signals, this is the mean signal in 0280 % each voxel. 0281 % 0282 % val = feGetRep(fe,'iso weights'); 0283 % val = feGetRep(fe,'iso weights'coords) 0284 % val = feGetRep(fe,'iso weights',voxelIndices) 0285 val = feGet(fe,'Miso') \ feGetRep(fe,'dsig full')'; 0286 val = val(feGet(fe,'voxelsindices',varargin)); 0287 0288 case {'dsigiso','isodsig'} 0289 % mean signalin each voxel, returned for each diffusion direction: 0290 % size(nBvecsxnVoxels, 1). 0291 % 0292 % val = feGetRep(fe,'iso disg'); 0293 % val = feGetRep(fe,'iso disg',coords) 0294 % val = feGetRep(fe,'iso dsig',voxelIndices) 0295 val = feGetRep(fe,'iso weights'); 0296 val = repmat(val,1,feGetRep(fe,'nbvecs'))'; 0297 val = val(:); 0298 0299 case {'dsigmeasured','dsigfull'} 0300 % Measured signal in VOI, this is the raw signal. not demeaned 0301 % 0302 % dSig = feGetRep(fe,'dSig full') 0303 val = fe.rep.diffusion_signal_img'; 0304 val = val(:)'; 0305 0306 % Return a subset of voxels 0307 if ~isempty(varargin) 0308 % voxelIndices = feGet(fe,'voxelsindices',varargin); 0309 % voxelRowsToKeep = feGet(fe,'voxel rows',voxelIndices); 0310 % val = val(voxelRowsToKeep,:); 0311 val = val(feGet(fe,'voxel rows',feGet(fe,'voxelsindices',varargin))); 0312 end 0313 0314 case {'diffusionsignaldemeaned','dsigdemeaned'} 0315 % Measured signal in VOI, demeaned, this is the signal used for the 0316 % fiber-portion of the M model. 0317 % 0318 % dSig = feGetRep(fe,'dsigdemeaned'); 0319 % dSig = feGetRep(fe,'dsigdemeaned',[1 10 100]); 0320 % dSig = feGetRep(fe,'dsigdemeaned',coords); 0321 nVoxels = feGet(fe,'nVoxels'); 0322 nBvecs = feGetRep(fe,'nBvecs'); 0323 val = (feGetRep(fe,'dsig measured') - reshape(repmat( ... 0324 mean(reshape(feGetRep(fe,'dsig measured'), nBvecs, nVoxels),1),... 0325 nBvecs,1), size(feGetRep(fe,'dsig measured'))))'; 0326 % Return a subset of voxels 0327 if ~isempty(varargin) 0328 % voxelIndices = feGet(fe,'voxelsindices',varargin); 0329 % voxelRowsToKeep = feGet(fe,'voxel rows',voxelIndices); 0330 % val = val(voxelRowsToKeep,:); 0331 val = val(feGet(fe,'voxel rows',feGet(fe,'voxelsindices',varargin))); 0332 end 0333 0334 case {'dsigrowssubset','diffusionsignaldemeanedinsubsetofrows'} 0335 % Get the demeaned signal for a subset of rows. 0336 % Useful for cross-validation. 0337 % 0338 % dSig = feGetRep(fe,'dsigrowssubset',voxelsList); 0339 dSig = feGetRep(fe,'dsigdemeaned'); 0340 for vv = 1:length(voxelsList) 0341 val(feGet(fe,'voxel rows',vv)) = dSig(feGet(fe,'voxel rows',voxelList(vv))); 0342 end 0343 0344 case {'totalr2'} 0345 % Return the global R2 (fraction of variance explained) of the full life 0346 % model. 0347 % 0348 % R2 = feGetRep(fe,'total r2'); 0349 0350 % measured = feGetRep(fe,'dsigdemeaned'); 0351 % predicted = feGetRep(fe,'fiber p sig'); 0352 % val = (1 - (sum((measured - predicted).^2 ) ./ ... 0353 % sum((measured - mean(measured)).^2) )); 0354 val = (1 - (sum((feGetRep(fe,'diffusion signal demeaned') - ... 0355 feGet(fe,'pSig fiber')).^2 ) ./ ... 0356 sum((feGetRep(fe,'diffusion signal demeaned') - ... 0357 mean(feGetRep(fe,'diffusion signal demeaned'))).^2) )); 0358 0359 case {'totalr2voxelwise'} 0360 % Return the global R2 (fraction of variance explained) of the full life 0361 % model from a voxel-wise fit 0362 % 0363 % R2 = feGetRep(fe,'total r2'); 0364 0365 % measured = feGetRep(fe,'dsigdemeaned'); 0366 % predicted = feGetRep(fe,'p sig f voxel wise'); 0367 % val = (1 - (sum((measured - predicted).^2 ) ./ ... 0368 % sum((measured - mean(measured)).^2) )); 0369 val = (1 - (sum((feGetRep(fe,'diffusion signal demeaned')' - ... 0370 feGet(fe,'pSig f voxel wise')).^2 ) ./ ... 0371 sum((feGetRep(fe,'diffusion signal demeaned') - ... 0372 mean(feGetRep(fe,'diffusion signal demeaned'))).^2) )); 0373 0374 case {'totpve'} 0375 % Total percent variance explained by data1 on data2 0376 % 0377 % R2 = feGetRep(fe,'tot pve data') 0378 val = 100 * feGetRep(fe,'total r2'); 0379 0380 case {'totalr2data'} 0381 % Return the global R2 (fraction of variance explained) of the full life 0382 % model in data set 2 by data set 1. 0383 % 0384 % R2 = feGetRep(fe,'total r2 data'); 0385 0386 % measured = feGetRep(fe,'dsigdemeaned'); 0387 % predicted = feGetRep(fe,'fiber p sig'); 0388 % val = (1 - (sum((measured - predicted).^2 ) ./ ... 0389 % sum((measured - mean(measured)).^2) )); 0390 val = (1 - (sum((feGetRep(fe,'diffusion signal demeaned') - ... 0391 feGet(fe,'diffusion signal demeaned')).^2 ) ./ ... 0392 sum((feGetRep(fe,'diffusion signal demeaned') - ... 0393 mean(feGetRep(fe,'diffusion signal demeaned'))).^2) )); 0394 0395 case {'totpvedata'} 0396 % Total percent variance explained by data1 on data2 0397 % 0398 % R2 = feGetRep(fe,'tot pve data') 0399 val = 100 * feGetRep(fe,'total r2 data'); 0400 0401 case {'totalrmsedata'} 0402 % Global root mean squared error of data1 on data 2 0403 % 0404 % rmse = feGetRep(fe,'rmse data') 0405 val = sqrt(mean((feGetRep(fe,'diffusion signal demeaned') - ... 0406 feGet(fe,'diffusion signal demeaned')).^2)); 0407 0408 case {'totalrmseratio'} 0409 % Global ratio of root mean squared error of Model/Data 0410 % 0411 % rmse = feGetRep(fe,'rmse data ratio') 0412 val = feGetRep(fe,'total rmse') ./ feGetRep(fe,'total rmse data'); 0413 0414 case {'totalrmseratiovoxelwise'} 0415 % Global ratio of root mean squared error of Model/Data from a 0416 % voxel-wise fit 0417 % 0418 % rmse = feGetRep(fe,'totalrmseratiovoxelwise') 0419 val = feGetRep(fe,'total rmse voxelwise') ./ feGetRep(fe,'total rmse data'); 0420 0421 case {'totalrmse','rmsetotal'} 0422 % Root mean squared error of the LiFE fit to the whole data 0423 % 0424 % rmse = feGetRep(fe,'rmsetotal') 0425 val = sqrt(mean((feGetRep(fe,'diffusion signal demeaned') - ... 0426 feGet(fe,'psigfiber')).^2)); 0427 0428 case {'totalrmsevoxelwise'} 0429 % Root mean squared error of the LiFE fit to the whole data from a 0430 % voxel-wise fit 0431 % 0432 % rmse = feGetRep(fe,'totalrmsevoxelwise') 0433 val = sqrt(mean((feGetRep(fe,'diffusion signal demeaned')' - ... 0434 feGet(fe,'psigfvoxelwise')).^2)); 0435 0436 case {'ressigfiber'} 0437 % Residual signal fiber prediction - measured_demeaned. 0438 % 0439 % res = feGetRep(fe,'res sig fiber') 0440 val = (feGetRep(fe,'dsigdemeaned') - feGet(fe,'psig fiber')); 0441 if ~isempty(varargin) 0442 % voxelIndices = feGet(fe,'voxelsindices',varargin); 0443 % voxelRowsToKeep = feGet(fe,'voxel rows',voxelIndices); 0444 % val = val(voxelRowsToKeep,:); 0445 val = val(feGet(fe,'voxel rows',feGet(fe,'voxelsindices',varargin))); 0446 end 0447 0448 case {'ressigfull'} 0449 % Residual signal full model prediction - measured signal. 0450 % 0451 % res = feGetRep(fe,'res sig full'); 0452 % res = feGetRep(fe, 'res sig full',coords); 0453 % res = feGetRep(fe, 'res sig full',voxelIndex); 0454 val = (feGetRep(fe,'dsig full') - feGet(fe,'psig full')'); 0455 if ~isempty(varargin) 0456 % voxelIndices = feGet(fe,'voxelsindices',varargin); 0457 % voxelRowsToKeep = feGet(fe,'voxel rows',voxelIndices); 0458 % val = val(voxelRowsToKeep,:); 0459 val = val(feGet(fe,'voxel rows',feGet(fe,'voxelsindices',varargin))); 0460 end 0461 0462 case {'ressigfullvoxelwise'} 0463 % Residual signal full model prediction from a multi-voxel fit. 0464 % 0465 % res = feGetRep(fe,'res sig full voxfit'); 0466 % res = feGetRep(fe, 'res sig full voxfit',coords); 0467 % res = feGetRep(fe, 'res sig full voxfit',voxelIndex); 0468 %tic,val = feGetRep(fe,'dsig demeaned') - feGet(fe,'psigfvoxelwise') + feGetRep(fe,'dsigiso');toc 0469 val = feGetRep(fe,'dsig full') - feGet(fe,'psigfvoxelwise'); 0470 if ~isempty(varargin) 0471 % voxelIndices = feGet(fe,'voxelsindices',varargin); 0472 % voxelRowsToKeep = feGet(fe,'voxel rows',voxelIndices); 0473 % val = val(voxelRowsToKeep,:); 0474 val = val(feGet(fe,'voxel rows',feGet(fe,'voxelsindices',varargin))); 0475 end 0476 0477 case {'voxressigfullvoxelwise'} 0478 % Residual signal full model prediction from a multi-voxel fit. 0479 % ORganized in nvecsxn 0480 % 0481 % res = feGetRep(fe,'voxressigfullvoxelwise'); 0482 % res = feGetRep(fe, 'voxressigfullvoxelwise',coords); 0483 % res = feGetRep(fe, 'voxressigfullvoxelwise',voxelIndex); 0484 %tic,val = feGetRep(fe,'dsig demeaned') - feGet(fe,'psigfvoxelwise') + feGetRep(fe,'dsigiso');toc 0485 val = reshape(feGetRep(fe,'ressigfullvoxelwise'),feGetRep(fe,'nbvecs'),feGet(fe,'nvoxels')); 0486 0487 if ~isempty(varargin) 0488 % voxelIndices = feGet(fe,'voxelsindices',varargin); 0489 % voxelRowsToKeep = feGet(fe,'voxel rows',voxelIndices); 0490 % val = val(voxelRowsToKeep,:); 0491 val = val(:,feGet(fe,'voxelsindices',varargin)); 0492 end 0493 0494 case {'voxisoweights','voxweightsiso','voxmeanvoxelsignal'} 0495 % Weights of the isotropic voxel signals, this is the mean signal in 0496 % each voxel. 0497 % Organized nBvecs x nVoxels 0498 % 0499 % val = feGet(fe,'voxiso weights'); 0500 % val = feGet(fe,'voxiso weights'coords) 0501 % val = feGet(fe,'voxiso weights',voxelIndices) 0502 val = feGet(fe,'Miso') \ feGetRep(fe,'dsig full')'; 0503 val = repmat(val,1,feGet(fe,'nbvecs'))'; 0504 0505 if ~isempty(varargin) 0506 % voxelIndices = feGet(fe,'voxelsindices',varargin); 0507 % voxelRowsToKeep = feGet(fe,'voxel rows',voxelIndices); 0508 % val = val(voxelRowsToKeep,:); 0509 val = val(:,feGet(fe,'voxelsindices',varargin)); 0510 end 0511 0512 case {'fiberressigwithmean'} 0513 % Residual signal fiber model prediction - demeaned measured signal 0514 % with added mean signal. VECTOR FORM. 0515 % 0516 % This is used to reconstruct an image (volume) to be used for the 0517 % refinement process. 0518 % 0519 % res = feGetRep(fe,'fiber res sig with mean'); 0520 0521 % predicted = feGet(fe,'psig fiber'); 0522 % measured = feGetRep(fe,'dsigdemeaned'); 0523 % val = (measured_full - predicted demeaned); 0524 val = (feGetRep(fe,'dsig full')' - feGet(fe,'psig fiber')); 0525 0526 if ~isempty(varargin) 0527 % voxelIndices = feGet(fe,'voxelsindices',varargin); 0528 % voxelRowsToKeep = feGet(fe,'voxel rows',voxelIndices); 0529 % val = val(voxelRowsToKeep,:); 0530 val = val(feGet(fe,'voxel rows',feGet(fe,'voxelsindices',varargin))); 0531 end 0532 0533 case {'predictedfullsignalvoxel','psigfullvox'} 0534 % Predicted signal by the full model in a set of voxeles. 0535 % 0536 % Vox subfield stores per voxel within the VOI 0537 % The pSig has size of the dwi. 0538 % It is stored as val = pSig(X,Y,Z,Theta) 0539 % 0540 % pSig = feGetRep(fe, 'pSig full by voxel'); 0541 % pSig = feGetRep(fe, 'pSig full by voxel',coords); 0542 % pSig = feGetRep(fe, 'pSig full by voxel',voxelIndex); 0543 nBvecs = feGetRep(fe,'nBvecs'); 0544 nVoxels = feGet(fe,'n voxels'); 0545 val = reshape(feGetRep(fe,'pSig full'), nBvecs, nVoxels); 0546 0547 case {'voxelr2','r2vox','voxr2','r2byvoxel'} 0548 % Return a column vector of the proportion of variance explained in 0549 % each voxel. 0550 % 0551 % R2byVox = feGetRep(fe,'voxr2'); 0552 % R2byVox = feGetRep(fe,'voxr2',coords); 0553 measured = feGetRep(fe,'dSig demeaned by voxel'); 0554 predicted = feGet(fe,'pSig f vox'); 0555 nBvecs = feGetRep(fe,'nBvecs'); 0556 val = (1 - (sum((measured - predicted).^2 ) ./ ... 0557 sum((measured - repmat(mean(measured), nBvecs,1)).^2 ) )); 0558 val = val(feGet(fe,'return voxel indices',varargin)); 0559 0560 case {'voxelss','ssvox','voxss','sumofsquaresbyvoxel'} 0561 % Return a column vector of sum of squares error of the model 0562 % prediction in each voxel 0563 % 0564 % ssem = feGetRep(fe,'voxss'); 0565 % ssem = feGetRep(fe,'voxss',coords); 0566 predicted = feGet(fe,'pSig f vox'); 0567 measured = feGetRep(fe,'dSig demeaned by voxel'); 0568 val = sum((measured - predicted).^2 ); 0569 val = val(feGet(fe,'return voxel indices',varargin)); 0570 0571 case {'voxelssdata','ssvoxdata','voxssdata','sumofsquaresbyvoxeldata'} 0572 % Return a column vector of sum of squares error of the data in 0573 % each voxel 0574 % 0575 % ssed = feGetRep(fe,'voxssedata'); 0576 % ssed = feGetRep(fe,'voxssdata',coords); 0577 measured1 = feGet(fe,'dSig demeaned by voxel'); 0578 measured2 = feGetRep(fe,'dSig demeaned by voxel'); 0579 val = sum((measured2 - measured1).^2 ); 0580 val = val(feGet(fe,'return voxel indices',varargin)); 0581 0582 case {'voxelr2data','r2voxdata','voxr2data','r2byvoxeldata'} 0583 % Return a column vector of the proportion of variance explained in 0584 % each voxel in data set 2 given the data in dataset 1. 0585 % 0586 % R2byVox = feGetRep(fe,'voxr2data'); 0587 % R2byVox = feGetRep(fe,'voxr2data',coords); 0588 measured1 = feGet(fe,'dSig demeaned by voxel'); 0589 measured2 = feGetRep(fe,'dSig demeaned by voxel'); 0590 nBvecs = feGetRep(fe,'nBvecs'); 0591 val = (1 - (sum((measured2 - measured1).^2 ) ./ ... 0592 sum((measured2 - repmat(mean(measured2), nBvecs,1)).^2 ) )); 0593 val = val(feGet(fe,'return voxel indices',varargin)); 0594 0595 case {'voxelr2zero','r2voxzero','voxr2zero','r2byvoxelzero'} 0596 % Return a column vector of the proportion of variance explained in 0597 % each voxel. (Normalized to the squared diffusion signal in each voxel) 0598 % 0599 % R2byVox = feGetRep(fe,'voxr2zero'); 0600 % R2byVox = feGetRep(fe,'voxr2zero',coords); 0601 measured = feGetRep(fe,'dSig demeaned by voxel'); 0602 predicted = feGet(fe,'pSig f vox'); 0603 val = (1 - (sum((measured - predicted).^2 ) ./ sum(measured.^2))); 0604 val = val(feGet(fe,'return voxel indices',varargin)); 0605 0606 case {'voxelr2pearson','r2voxpearson','voxr2corr','r2byvoxelpearson'} 0607 % Return a column vector of the squre of the pearson correlation coefficient 0608 % 0609 % R2byVox = feGetRep(fe,'voxr2corr'); 0610 % R2byVox = feGetRep(fe,'voxr2corr',coords); 0611 measured = feGetRep(fe,'dSig demeaned by voxel'); 0612 predicted = feGet(fe,'pSig f vox'); 0613 val = corrcoef(measured - predicted).^2; 0614 val = val(feGet(fe,'return voxel indices',varargin)); 0615 0616 case {'voxelr2zerodata','r2voxzerodata','voxr2zerodata','r2byvoxelzerodata'} 0617 % Return a column vector of the proportion of variance explained in 0618 % each voxel in dataset 1 given the data in data set 2. 0619 % (Normalized to the squared diffusion signal in each voxel) 0620 % 0621 % R2byVox = feGetRep(fe,'voxr2zerodata'); 0622 % R2byVox = feGetRep(fe,'voxr2zerodata',coords); 0623 measured = feGet(fe,'dSig demeaned by voxel'); 0624 measured2 = feGetRep(fe,'dSig demeaned by voxel'); 0625 val = (1 - (sum((measured - measured2).^2 ) ./ sum(measured.^2))); 0626 val = val(feGet(fe,'return voxel indices',varargin)); 0627 0628 0629 case {'voxelr2voxelwise','r2voxvoxelwise','voxr2voxelwise','r2voxelwisebyvoxel'} 0630 % Return a column vector of the proportion of variance explained in 0631 % each voxel. 0632 % 0633 % R2byVox = feGetRep(fe,'voxr2voxelwise'); 0634 % R2byVox = feGetRep(fe,'voxr2voxelwise',coords); 0635 measured = feGetRep(fe,'dSig demeaned by voxel'); 0636 predicted = feGet(fe,'pSig f voxel wise by voxel'); 0637 nBvecs = feGetRep(fe,'nBvecs'); 0638 val = (1 - (sum((measured - predicted).^2 ) ./ ... 0639 sum((measured - repmat(mean(measured), nBvecs,1)).^2 ) )); 0640 val = val(feGet(fe,'return voxel indices',varargin)); 0641 0642 case {'voxelr2zerovoxelwise','r2zerovoxelwisebyvoxel','voxr2zerovoxelwise'} 0643 % Return a column vector of the proportion of variance explained in 0644 % each voxel. (Normalized to the squared diffusion signal in each voxel) 0645 % 0646 % R2byVox = feGetRep(fe,'voxr2zerovoxelwise'); 0647 % R2byVox = feGetRep(fe,'voxr2zerovoxelwise',coords); 0648 measured = feGetRep(fe,'dSig demeaned by voxel'); 0649 predicted = feGet(fe,'pSig f voxel wise by voxel'); 0650 val = (1 - (sum((measured - predicted).^2 ) ./ sum(measured.^2))); 0651 val = val(feGet(fe,'return voxel indices',varargin)); 0652 0653 case {'voxelvarianceexplained','varexpvox','voxvarexp','varexpbyvoxel'} 0654 % Return the percent of varince explained in each voxel. 0655 % 0656 % R2byVox = feGetRep(fe,'var exp by voxel'); 0657 % R2byVox = feGetRep(fe,'var exp by voxel',coords); 0658 val = 100.*feGetRep(fe,'voxr2'); 0659 val = val(feGet(fe,'return voxel indices',varargin)); 0660 0661 case {'voxelvarianceexplaineddata','varexpvoxdata','voxvarexpdata','varexpbyvoxeldata'} 0662 % Return the percent of variance explained in each voxel in data set 1 0663 % given the data in data set 2. 0664 % 0665 % R2byVox = feGetRep(fe,'var exp by voxel data'); 0666 % R2byVox = feGetRep(fe,'var exp by voxel data',coords); 0667 val = 100.*feGetRep(fe,'voxr2 data'); 0668 val = val(feGet(fe,'return voxel indices',varargin)); 0669 0670 case {'dsigdemeanedbyvoxel','dsigdemeanedvox'} 0671 % Demeaned diffusion signal in each voxel 0672 % 0673 % dSigByVoxel = feGetRep(fe,'dsigdemeaned by Voxel'); 0674 % dSigByVoxel = feGetRep(fe,'dsigdemeaned by Voxel',coords); 0675 % dSigByVoxel = feGetRep(fe,'dsigdemeaned by Voxel',vxIndex); 0676 nBvecs = feGetRep(fe,'nBvecs'); 0677 nVoxels = feGet(fe,'n voxels'); 0678 val = reshape(feGetRep(fe,'dsigdemeaned'), nBvecs, nVoxels); 0679 val = val(:,feGet(fe,'return voxel indices',varargin)); 0680 0681 case {'dsigfullbyvoxel','dsigfullvox'} 0682 % Full (measured) signal in each voxel 0683 % 0684 % dSigByVoxel = feGetRep(fe,'dSig full by Voxel'); 0685 % dSigByVoxel = feGetRep(fe,'dSig full by Voxel',coords); 0686 % dSigByVoxel = feGetRep(fe,'dSig full by Voxel',vxIndex); 0687 nBvecs = feGetRep(fe,'nBvecs'); 0688 nVoxels = feGet(fe,'n voxels'); 0689 val = reshape(feGetRep(fe,'dSig full'), nBvecs, nVoxels); 0690 val = val(:,feGet(fe,'return voxel indices',varargin))'; 0691 0692 case {'voxelrmse','voxrmse'} 0693 % A volume of RMSE values 0694 % 0695 % RMSE = feGetRep(fe,'vox rmse') 0696 % RMSE = feGetRep(fe,'vox rmse',coords) 0697 % RMSE = feGetRep(fe,'vox rmse',vxIndex) 0698 measured = feGetRep(fe,'dsigdemeaned by voxel'); 0699 predicted = feGet(fe,'pSig f vox'); 0700 val = sqrt(mean((measured - predicted).^2,1)); 0701 val = val(feGet(fe,'return voxel indices',varargin)); 0702 0703 case {'voxelrmsevoxelwise','voxrmsevoxelwise'} 0704 % A volume of RMSE values optained with the voxel-wise (vw) fit. 0705 % 0706 % RMSE = feGetRep(fe,'vox rmse vw') 0707 % RMSE = feGetRep(fe,'vox rmse vw',coords) 0708 % RMSE = feGetRep(fe,'vox rmse vw',vxIndex) 0709 measured = feGetRep(fe,'dsigdemeaned by voxel'); 0710 predicted = feGet(fe,'pSig f voxel wise by voxel'); 0711 val = sqrt(mean((measured - predicted).^2,1)); 0712 val = val(feGet(fe,'return voxel indices',varargin)); 0713 0714 case {'voxelrmseratio','voxrmseratio'} 0715 % A volume with the ratio of the RMSE of model/data 0716 % 0717 % rmseRatio = feGetRep(fe,'vox rmse ratio') 0718 % rmseRatio = feGetRep(fe,'vox rmse ratio',coords) 0719 % rmseRatio = feGetRep(fe,'vox rmse ratio',vxIndex) 0720 rmseData = feGetRep(fe,'vox rmse data'); 0721 rmseModel = feGetRep(fe,'vox rmse'); 0722 val = rmseModel ./ rmseData; 0723 val = val(feGet(fe,'return voxel indices',varargin)); 0724 0725 case {'prmseratio','proportionrmseratio'} 0726 % The probability of a ratio-value in the volume. 0727 % Default across 25 log-distributed bins between [.5,2] 0728 % 0729 % rmseRatio = feGetRep(fe,'p rmse ratio') 0730 % 0731 % % Change the bins over whih the proportions are computed: 0732 % bins = logspace(log10(.25),log10(4),50) 0733 % rmseRatio = feGetRep(fe,'p rmse ratio',bins) 0734 if isempty(varargin) 0735 bins = logspace(log10(.5),log10(2),25); 0736 end 0737 % Extract the rmse ratio in each voxel 0738 Rrmse = feGetRep(fe,'vox rmse ratio'); 0739 % Compute the number of occurrences for a range of values. 0740 [val(1,:),val(2,:)] = hist(Rrmse,bins); 0741 val(1,:) = val(1,:)./sum(val(1,:)); 0742 0743 case {'voxelrmseratiovoxelwise','voxrmseratiovoxelwise'} 0744 % A volume with the ratio of the RMSE of model/data 0745 % 0746 % rmseRatio = feGetRep(fe,'vox rmse ratio voxel wise') 0747 % rmseRatio = feGetRep(fe,'vox rmse ratio voxel wise',coords) 0748 % rmseRatio = feGetRep(fe,'vox rmse ratio voxel wise',vxIndex) 0749 rmseData = feGetRep(fe,'vox rmse data'); 0750 rmseModel = feGetRep(fe,'vox rmse voxel wise'); 0751 val = rmseModel ./ rmseData; 0752 val = val(feGet(fe,'return voxel indices',varargin)); 0753 0754 case {'voxelrmsedata','voxrmsedata'} 0755 % A volume of RMSE values from data set 1 to data set 2 0756 % 0757 % RMSE = feGetRep(fe,'vox rmse data') 0758 % RMSE = feGetRep(fe,'vox rmse data',coords) 0759 % RMSE = feGetRep(fe,'vox rmse data',vxIndex) 0760 measured = feGet(fe,'dsigdemeaned by voxel'); 0761 measured2 = feGetRep(fe,'dsigdemeaned by voxel'); 0762 val = sqrt(mean((measured - measured2).^2,1)); 0763 val = val(feGet(fe,'return voxel indices',varargin)); 0764 0765 case {'voxelrmsetest','voxrmsetest'} 0766 % A volume of RMSE values with a subset of fibers' weights set to 0. 0767 % 0768 % RMSE = feGetRep(fe,'vox rmse',fiberIndices) 0769 % RMSE = feGetRep(fe,'vox rmse',fiberIndices,coords) 0770 % RMSE = feGetRep(fe,'vox rmse',fiberIndices,voxelIndex) 0771 measured = feGetRep(fe,'dsigdemeaned by voxel'); 0772 % Reshape the predicted signal by voxles 0773 predicted = reshape(feGet(fe,'pSig fiber test voxel wise',varargin{1}), feGetRep(fe,'nBvecs'), feGet(fe,'nVoxels')); 0774 val = sqrt(mean((measured - predicted).^2,1)); 0775 0776 if length(varargin) == 2 0777 val = val(feGet(fe,'return voxel indices',varargin)); 0778 end 0779 0780 case {'voxelrmsetestvoxelwise','voxrmsetestvoxelwise'} 0781 % A volume of RMSE values with a subset of fibers' weights set to 0. 0782 % 0783 % RMSE = feGetRep(fe,'voxel rmse test voxel wise',fiberIndices) 0784 % RMSE = feGetRep(fe,'voxel rmse test voxel wise',fiberIndices,coords) 0785 % RMSE = feGetRep(fe,'voxel rmse test voxel wise',fiberIndices,voxelIndex) 0786 measured = feGetRep(fe,'dsigdemeaned by voxel'); 0787 % Reshape the predicted signal by voxles 0788 predicted = reshape(feGet(fe,'pSig fiber test voxel wise',varargin{1}), feGetRep(fe,'nBvecs'), feGet(fe,'nVoxels')); 0789 val = sqrt(mean((measured - predicted).^2,1)); 0790 0791 if length(varargin) == 2 0792 val = val(feGet(fe,'return voxel indices',varargin)); 0793 end 0794 0795 case {'residualsignalfibervoxel','resfibervox'} 0796 % Fibers' residual signal by voxel 0797 % 0798 % res = feGetRep(fe,'res sig fiber vox') 0799 % res = feGetRep(fe,'res sig fiber vox',coords) 0800 % res = feGetRep(fe,'res sig fiber vox',vxIndex) 0801 nBvecs = feGetRep(fe,'nBvecs'); 0802 nVoxels = feGet(fe,'n voxels'); 0803 val = reshape(feGetRep(fe,'res sig fiber'), nBvecs, nVoxels); 0804 val = val(:,feGet(fe,'return voxel indices',varargin))'; 0805 0806 case {'residualsignalfullvoxel','resfullvox'} 0807 % Full (measured) residual signal by voxel 0808 % 0809 % res = feGetRep(fe,'res sig full vox') 0810 % res = feGetRep(fe,'res sig full vox',coords) 0811 % res = feGetRep(fe,'res sig full vox',vxIndex) 0812 nBvecs = feGetRep(fe,'nBvecs'); 0813 nVoxels = feGet(fe,'n voxels'); 0814 val = reshape(feGetRep(fe,'res sig full'), nBvecs, nVoxels); 0815 val = val(:,feGet(fe,'return voxel indices',varargin))'; 0816 0817 case {'fiberressigwithmeanvoxel'} 0818 % Residual signal fiber model prediction - demeaned measured signal 0819 % with added mean signal. VOXEL FORM (nBvecs x nVoxel). 0820 % 0821 % This is used to reconstruct an image (volume) to be used for the 0822 % refinement process. 0823 % 0824 % res = feGetRep(fe,'fiber res sig with mean'); 0825 0826 % predicted = feGet(fe,'psig fiber'); 0827 % measured = feGetRep(fe,'dsigdemeaned'); 0828 % val = (measured - predicted) + (measured_full - measured); 0829 val = feGetRep(fe,'fiberressigwithmean'); 0830 nBvecs = feGetRep(fe,'nBvecs'); 0831 nVoxels = feGet(fe,'n voxels'); 0832 val = reshape(val, nBvecs, nVoxels); 0833 0834 if ~isempty(varargin) 0835 % voxelIndices = feGet(fe,'voxelsindices',varargin); 0836 % voxelRowsToKeep = feGet(fe,'voxel rows',voxelIndices); 0837 % val = val(voxelRowsToKeep,:); 0838 val = val(:, feGet(fe,'return voxel indices',varargin)); 0839 end 0840 0841 case {'fiberressigwithmeanvox','resfibermeanvox'} 0842 % Fibers' residual signal by voxel with mean signal added (with added 0843 % isotropic component). 0844 % 0845 % This is used to compute the residual signal for the refinement. 0846 % 0847 % res = feGetRep(fe,'fiber res sig with mean vox') 0848 % res = feGetRep(fe,'fiber res sig with mean vox',coords) 0849 % res = feGetRep(fe,'fiber res sig with mean vox',vxIndex) 0850 nBvecs = feGetRep(fe,'nBvecs'); 0851 nVoxels = feGet(fe,'n voxels'); 0852 val = reshape(feGetRep(fe,'fiber res sig with mean'), nBvecs, nVoxels); 0853 val = val(:,feGet(fe,'return voxel indices',varargin))'; 0854 0855 case {'volumesize','dims','dim','imagedim'} 0856 % Dimensions of the DW volume. 0857 % 0858 % dim = feGetRep(fe,'dims') 0859 val = fe.rep.imagedim; 0860 case {'mapsize'} 0861 % Dimensions of the maps of parameters and results. 0862 % 0863 % dims = feGetRep(fe, 'mapsize') 0864 val = fe.rep.imagedim(1:3); 0865 0866 otherwise 0867 help('feGetRep') 0868 fprintf('[feGetRep] Unknown parameter << %s >>...\n',param); 0869 keyboard 0870 end 0871 0872 end % END MAIN FUNCTION