data(data<0)=0 On 29 Sep 2016, at 11:41, Ana Maria Escorza <[log in to unmask]<mailto:[log in to unmask]>> wrote: Thanks, that is for 0 values. But my sse has complex values after that. And it is different from sse obtain from dtifii Cheers, Ana. 2016-09-29 12:35 GMT+02:00 Saad Jbabdi <[log in to unmask]<mailto:[log in to unmask]>>: An easy way to do this in matlab: SSE = sum ( (log(data+~data) - log(pred+~pred)).^2, 4 ) The trick of doing x+~x means when x=0, then x+~x=1 and the log is zero, so doesn’t count in the sum. Cheers Saad On 29 Sep 2016, at 11:08, Ana Maria Escorza <[log in to unmask]<mailto:[log in to unmask]>> wrote: You mean do not do the logarithm of negative values? Remove negative values and put in after do the log? 2016-09-29 12:02 GMT+02:00 Saad Jbabdi <[log in to unmask]<mailto:[log in to unmask]>>: In matlab, log is ln Just remove negative values before you calculate the sse On 29 Sep 2016, at 10:49, Ana Maria Escorza <[log in to unmask]<mailto:[log in to unmask]>> wrote: Hi, with log you mean log10 or ln? what you mean with safeguards? I do that I obtain complex numbers in sse. Cheers 2016-09-29 10:51 GMT+02:00 Saad Jbabdi <[log in to unmask]<mailto:[log in to unmask]>>: Hi - I believe DTIFIT outputs the sum squared error in log-space, i.e. sum( { log(data) - log(prediction) }^2 ) There are also a couple of safeguards inside DTIFIT to make sure it can take the log. Cheers Saad On 29 Sep 2016, at 08:21, Ana Maria Escorza <[log in to unmask]<mailto:[log in to unmask]>> wrote: Once I have got the original DWIs and 'DWIs from DTs' exported (with dtigen) and load into matlab, I try to calculate the sse of tensor estimation that is calculated by sum((orDWI-DWI_DT).^2,4) But I didn't obtain the same that with --sse in dtifit, why? 2016-09-28 18:22 GMT+02:00 Ana Maria Escorza <[log in to unmask]<mailto:[log in to unmask]>>: How Can I subtract? with fslmaths from both .nii? 2016-09-28 18:18 GMT+02:00 Saad Jbabdi <[log in to unmask]<mailto:[log in to unmask]>>: Hi - you can use ‘dtigen’ to generate predictions given the DTI tensor (which you can save in DTIFIT with —save_tensor) and then substract that prediction from the data. Cheers Saad On 28 Sep 2016, at 14:42, Ana E. <[log in to unmask]<mailto:[log in to unmask]>> wrote: Hello, I am looking for a function to obtain the residual DWI from the diffusion tensor. I see that I can use --sse in dtifit, but this is for 3D volume. I would like 4D. Thanks Ana.