Set all the fields necessary to store the DWI measurements. This can be used for the dwi measurements use to build the model as well as for those used as a second repeat. Inputs: fe - an fe structure dwiFileName - the full path to a dwi nifti file isrepeat - wether the file being set up is the origianl data used to build LiFE or a repeated measurements used to compute statistcs of the quality of fit. Outputs: fe - fe structure with data added in the appropriate fields. fe = feConnectomeSetDwi(fe,dwiFileName); % Set the original data fe = feConnectomeSetDwi(fe,dwiFileName,1); % Set the repeated measure % data Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com.
0001 function fe = feConnectomeSetDwi(fe,dwiFileName,isrepeat) 0002 % Set all the fields necessary to store the DWI measurements. 0003 % 0004 % This can be used for the dwi measurements use to build the model as well 0005 % as for those used as a second repeat. 0006 % 0007 % Inputs: 0008 % fe - an fe structure 0009 % dwiFileName - the full path to a dwi nifti file 0010 % isrepeat - wether the file being set up is the origianl data used to 0011 % build LiFE or a repeated measurements used to compute 0012 % statistcs of the quality of fit. 0013 % Outputs: 0014 % fe - fe structure with data added in the appropriate fields. 0015 % 0016 % fe = feConnectomeSetDwi(fe,dwiFileName); % Set the original data 0017 % fe = feConnectomeSetDwi(fe,dwiFileName,1); % Set the repeated measure 0018 % % data 0019 % 0020 % Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com. 0021 0022 % Check inputs 0023 if notDefined('isrepeat'), isrepeat=0;end 0024 0025 % Build a tag for the calls to feSet. 0026 if isrepeat, tag = sprintf('repeat'); 0027 else tag = sprintf(''); 0028 end 0029 0030 % Set the ile name in the structure 0031 fe = feSet(fe, sprintf('dwi%sfile',tag),dwiFileName); 0032 0033 % load the dwi data 0034 dwi = feGet(fe, sprintf('dwi%s',tag)); 0035 0036 % Store the bvecs, bvals and the indices for the new file. 0037 fe = feSet(fe, sprintf('diffusion bvecs %s',tag), ... 0038 dwiGet(dwi, 'diffusion bvecs')); 0039 fe = feSet(fe, sprintf('diffusion bvals %s',tag), ... 0040 dwiGet(dwi, 'diffusion bvals')); 0041 fe = feSet(fe, sprintf('bvecs indices %s',tag), ... 0042 dwiGet(dwi, 'diffusionimagenums')); 0043 0044 % Extract the dwi signal at the coordinates of the connectome 0045 fe = feSet(fe, sprintf('diffusion signal image %s',tag), ... 0046 dwiGet(dwi, 'diffusion signal image',feGet(fe,'roi coords')) ); 0047 0048 % Extract the non-diffusion direction signal at the coordinates of the 0049 % conenctome 0050 fe = feSet(fe, sprintf('S0 image %s',tag), ... 0051 dwiGet(dwi, 'S0 image',feGet(fe,'roi coords'))); 0052 0053 if length(isrepeat)>1, keyboard;end 0054 0055 % Here I set the dimensions of the dwi file so that I have that 0056 % available everytime when creating a map of parameters. 0057 fe = feSet(fe,sprintf('img size %s',tag),dwiGet(dwi,'size')); 0058 0059 end