dke-questions > Specific error with Inf/NaN
Showing 1-6 of 6 posts
Display:
Results per page:
Jul 25, 2018  12:07 PM | Alzbeta Minsterova
Specific error with Inf/NaN
Hello everyone, 

I have 4D nifiti DKI data of many patients and I am calling DKE via command line, using my own b-vectors. It worked well for majority of my subjects. However, there are few subjects with following error:

Diffusional Kurtosis Estimator (DKE) version 2.6.0
Reading input images... complete
Filtering input images... complete.
Processing voxels... 6% complete.Error using parallel_function (line 589)

Input to EIG must not contain NaN or Inf.
Error stack:
dke_estimate>dke_core at 1023
dke_estimate>(parfor body) at 441
Error in dke_estimate (line 438)
Error in dke (line 182)
MATLAB:eig:matrixWithNaNInf

I have checked and there are no Infs or NaNs in my images or b-vecs. However, if I try to calculate maps of these patients with GUI using default vectors, it works withour errors. Therefore I think, there is some problem which DKE/MATLAB cannot handle during the calculations (e.g. dividing by 0 or so). 

Is there any possibility to get inside the DKE code, so I can debug it maybe? Or did anyone have simmilar problems? Did you solve it, anyhow?

Thanks in advance!
Alzbeta
Aug 13, 2018  02:08 PM | Emilie McKinnon - MUSC
RE: Specific error with Inf/NaN
Hi Alzbeta, 

I have ran into this problem before. That said, it tends to happen when I actually have NaNs at the edge of my image that were introduced by preprocessing :). One thing that comes to mind is that a gradient vector of [0,0,0] left in your .txt will introduce NaNs/Inf as well. Is that the case here? Feel free to share the gradient file with us if you would like. I would also be happy to look at your data. 

My apologies for the delay in responding. 

Best, 
Emilie
Aug 14, 2018  08:08 AM | Alzbeta Minsterova
RE: Specific error with Inf/NaN
Originally posted by Emilie McKinnon:
Hi Alzbeta, 

I have ran into this problem before. That said, it tends to happen when I actually have NaNs at the edge of my image that were introduced by preprocessing :). One thing that comes to mind is that a gradient vector of [0,0,0] left in your .txt will introduce NaNs/Inf as well. Is that the case here? Feel free to share the gradient file with us if you would like. I would also be happy to look at your data. 

My apologies for the delay in responding. 

Best, 
Emilie

Hello Emilie, 

thank you for your answer. I am attaching the data of one patient (four bvecs .txt files for bvals 500, 1000, 2000, 4000 s/mm2 (yes, we know, that 4000 is too much but we are trying anyway), the data and the DKEParameters.dat file).

I will be more that happy if you identify some problem. I am already out of ideas.

Best, 
Alzbeta
Aug 14, 2018  09:08 AM | Alzbeta Minsterova
RE: Specific error with Inf/NaN
Uhm, seems like the attachement is to big for this forum.
I will try to send it to you via email. 
Thanks for help, 
Best, 
A.
Aug 14, 2018  11:08 AM | Emilie McKinnon - MUSC
RE: Specific error with Inf/NaN
Got it! Will let you know what the problem is asap. 

Best, 
Emilie
Sep 26, 2018  09:09 PM | Emilie McKinnon - MUSC
RE: Specific error with Inf/NaN
Hi Alzbeta, 

I believe the errors are caused by the robust fitting option. If you change dki_method.robust_option = 0 your data runs fine on my end. I have always done the tensor fitting using the constrained least squares and cleaned up some of the poor fits using median filtering. So, I am not familiar with the exact details of the robust fitting. That said, at first glance it looks like for a few voxels the code treats every gradient direction as an outlier and ends up with empty matrices which results in inf /NaN later on.  I don't know what your preprocessing steps are but denoising your data helps alleviate some of these bad fitting voxels. 

Best, 
Emilie