[Neuroimaging] failure using DIPY Free Water Elimination DTI

Ping-Hong Yeh pinghongyeh at gmail.com
Wed Jan 9 07:47:03 EST 2019


Hi Ariel

Have you got the mask file?

Any update?

Thanks!
Ping

On Fri, Jan 4, 2019 at 1:31 PM Ping-Hong Yeh <pinghongyeh at gmail.com> wrote:

> I have attached the mask file.  Thank you.
>
> maskimg = nib.load(join(dname, 'structural_mask.nii.gz'))
> mask = maskimg.get_data()
> affinemask = maskimg.affine
>
>
> On Fri, Jan 4, 2019 at 1:13 PM Ariel Rokem <arokem at gmail.com> wrote:
>
>>
>> On Fri, Jan 4, 2019 at 7:42 AM Ping-Hong Yeh <pinghongyeh at gmail.com>
>> wrote:
>>
>>> Hi Ariel,
>>>
>>> Thank you for your time.
>>>  I've run fslmaths using the syntax of -nan  beforehand, i thought that
>>> has taken care of it.
>>>
>>
>> I believe it's still there. My script crashed on that.
>>
>>
>>> Here is the script i used,
>>>
>>> import dipy.reconst.fwdti as fwdti
>>> Delta = 22.536
>>> delta = 21.908
>>> _Delta = 0.022536
>>> _delta = 0.021908
>>>
>>> dname=os.path.join('/data/NEURO2/ping/MUX', id,
>>> 'SOA_N270_plus19b0_fwd','data_DIFFPREP_t2acpc_proc_DRBUDDI_proc')
>>> fdwi = join(dname,
>>> 'data_DIFFPREP_t2acpc_proc_DRBUDDI_up_final_no7b0_nan.nii.gz')
>>> fbvec = join(dname,
>>> 'data_DIFFPREP_t2acpc_proc_DRBUDDI_up_final_no7b0_invY.bvecs') #the final
>>> oriention after TORTOISE is RAS for earlier SOA289 data
>>> fbval = join(dname,
>>> 'data_DIFFPREP_t2acpc_proc_DRBUDDI_up_final_no7b0.bvals')
>>>
>>> from dipy.io import read_bvals_bvecs
>>> bvals, bvecs = read_bvals_bvecs(fbval, fbvec)
>>> from dipy.core.gradients import gradient_table
>>> gtab = gradient_table(bvals, bvecs, big_delta=Delta, small_delta=delta)
>>> img = nib.load(fdwi)
>>> data = img.get_data()
>>> affine = img.affine
>>>
>>> #free water
>>> fwdtimodel = fwdti.FreeWaterTensorModel(gtab, fit_method='NLS' )
>>> fwdtifit = fwdtimodel.fit(data, mask=mask)
>>> img = nib.Nifti1Image(fwdtifit.fa, affine)
>>> nib.save(img, join(dname, 'FWdti_FA.nii.gz'))
>>> img = nib.Nifti1Image(fwdtifit.md, affine)
>>> nib.save(img, join(dname, 'FWdti_MD.nii.gz'))
>>> img = nib.Nifti1Image(fwdtifit.ad, affine)
>>> nib.save(img, join(dname, 'FWdti_AD.nii.gz'))
>>> img = nib.Nifti1Image(fwdtifit.rd, affine)
>>> nib.save(img, join(dname, 'FWdti_RD.nii.gz'))
>>> img = nib.Nifti1Image(fwdtifit.f, affine)
>>> nib.save(img, join(dname, 'FWdti_fw.nii.gz'))
>>>
>>>
>> Where did `mask` come from?
>>
>> Cheers,
>>
>> Ariel
>>
>>>
>>> On Fri, Jan 4, 2019 at 9:23 AM Ariel Rokem <arokem at gmail.com> wrote:
>>>
>>>> Hi Ping,
>>>>
>>>> I can't quite reproduce your error, though I am getting similar errors.
>>>> Could you also share the code that you are running?
>>>>
>>>> For the time being, the one thing that I noticed is that there are NaNs
>>>> in your data. That might be causing this issue.
>>>>
>>>> Cheers,
>>>>
>>>> Ariel
>>>>
>>>>
>>>>
>>>> On Mon, Dec 31, 2018 at 5:43 AM Ping-Hong Yeh <pinghongyeh at gmail.com>
>>>> wrote:
>>>>
>>>>> Hi Ariel,
>>>>>
>>>>>  Have you got the chance to look at the DWI data that was attached to
>>>>> the previous email?
>>>>>
>>>>> Thank you for your time.
>>>>>
>>>>> Ping
>>>>>
>>>>> On Sat, Dec 29, 2018 at 1:12 AM Ariel Rokem <arokem at gmail.com> wrote:
>>>>>
>>>>>> Hi Ping,
>>>>>>
>>>>>> Thanks for your email. Hard to say exactly what is going on without
>>>>>> further information. Could you tell us more about the data you are using?
>>>>>> How many b-values? How many directions? Any chance you could share the data
>>>>>> from the voxel that caused that error to be raised?
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> Ariel
>>>>>>
>>>>>> On Thu, Dec 27, 2018 at 6:55 AM Ping-Hong Yeh <pinghongyeh at gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi Dipy Users,
>>>>>>>
>>>>>>>  I've ran into errors "Eigenvalues did not  converge" when using the
>>>>>>> free water elimination model,
>>>>>>> and here is the error message:
>>>>>>>
>>>>>>>   File
>>>>>>> "/Users/yehp/anaconda3/lib/python3.6/site-packages/dipy/reconst/dti.py",
>>>>>>> line 1615, in _decompose_tensor_nan
>>>>>>>     min_diffusivity=min_diffusivity)
>>>>>>>   File
>>>>>>> "/Users/yehp/anaconda3/lib/python3.6/site-packages/dipy/reconst/dti.py",
>>>>>>> line 1946, in decompose_tensor
>>>>>>>     eigenvals, eigenvecs = eigh(tensor)
>>>>>>>   File
>>>>>>> "/Users/yehp/anaconda3/lib/python3.6/site-packages/dipy/utils/arrfuncs.py",
>>>>>>> line 128, in eigh
>>>>>>>     return np.linalg.eigh(a, UPLO)
>>>>>>>   File
>>>>>>> "/Users/yehp/anaconda3/lib/python3.6/site-packages/numpy/linalg/linalg.py",
>>>>>>> line 1291, in eigh
>>>>>>>     w, vt = gufunc(a, signature=signature, extobj=extobj)
>>>>>>>   File
>>>>>>> "/Users/yehp/anaconda3/lib/python3.6/site-packages/numpy/linalg/linalg.py",
>>>>>>> line 95, in _raise_linalgerror_eigenvalues_nonconvergence
>>>>>>>     raise LinAlgError("Eigenvalues did not converge")
>>>>>>> numpy.linalg.linalg.LinAlgError: Eigenvalues did not converge
>>>>>>>
>>>>>>>
>>>>>>> Any suggestions?
>>>>>>>
>>>>>>> Thank you.
>>>>>>>
>>>>>>> Ping
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Neuroimaging mailing list
>>>>>>> Neuroimaging at python.org
>>>>>>> https://mail.python.org/mailman/listinfo/neuroimaging
>>>>>>>
>>>>>> _______________________________________________
>>>>>> Neuroimaging mailing list
>>>>>> Neuroimaging at python.org
>>>>>> https://mail.python.org/mailman/listinfo/neuroimaging
>>>>>>
>>>>> _______________________________________________
>>>>> Neuroimaging mailing list
>>>>> Neuroimaging at python.org
>>>>> https://mail.python.org/mailman/listinfo/neuroimaging
>>>>>
>>>> _______________________________________________
>>>> Neuroimaging mailing list
>>>> Neuroimaging at python.org
>>>> https://mail.python.org/mailman/listinfo/neuroimaging
>>>>
>>> _______________________________________________
>>> Neuroimaging mailing list
>>> Neuroimaging at python.org
>>> https://mail.python.org/mailman/listinfo/neuroimaging
>>>
>> _______________________________________________
>> Neuroimaging mailing list
>> Neuroimaging at python.org
>> https://mail.python.org/mailman/listinfo/neuroimaging
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20190109/58f67d39/attachment.html>


More information about the Neuroimaging mailing list