[Neuroimaging] [DIPY] propagator anisotropy estimation using MAP(L)MRI

Rutger Fick fick.rutger at gmail.com
Tue Jan 16 19:18:35 EST 2018


Hi Ping,

Reading the error messages, it looks like you're fitting a masked voxel.
The following error:

/Library/Python/2.7/site-packages/dipy/reconst/mapmri_pa.py:389:
RuntimeWarning: invalid value encountered in divide
  data = np.asarray(data / data[self.gtab.b0s_mask].mean())

says you're dividing by either zero or NaN, which means your b0 value of
that voxel was zero (or you had no b0 values possibly). Note that mapmri
needs at least one b0 measurement.
I recommend you check if it works when you fit a voxel that you know for
sure is in white matter. If it works, you can do something like
map_model_L.fit(data,
mask=data[..., 0]>0) to use a mask that only fits if the first measured DWI
is positive (assuming your first measurement is a b0).

Best,
Rutger



On 16 January 2018 at 23:46, Ping-Hong Yeh <pinghongyeh at gmail.com> wrote:

> Hi Rutger,
>
> I got an error running the map_model.fit using mapmri_pa. Here is the
> scripts i used,
>
>
> map_model_L = mapmri_pa.MapmriModel(gtab, radial_order=radial_order,
>                                laplacian_regularization=True,  # this
> regularization enhances reproducibility of estimated q-space indices by
> imposing smoothness
>                                laplacian_weighting="GCV",  # this makes it
> use generalized cross-validation to find the best regularization weight
>                                positivity_constraint=True)  # this ensures
> the estimated PDF is positive
>
> mapfit_L = map_model_L.fit(data)
>
> , and the error message,
>
>
> /Library/Python/2.7/site-packages/dipy/core/geometry.py:129:
> RuntimeWarning: invalid value encountered in true_divide
>   theta = np.arccos(z / r)
> /Library/Python/2.7/site-packages/dipy/reconst/mapmri_pa.py:364:
> UserWarning: The MAPMRI positivity constraint depends on CVXOPT (http:
> xopt.org/). CVXOPT is licensed under the GPL (see:
> http://cvxopt.org/copyright.html) and you may be subject to this license
> when using positivity constraint.
>   warn(w_s)
> /Library/Python/2.7/site-packages/dipy/reconst/mapmri_pa.py:389:
> RuntimeWarning: invalid value encountered in divide
>   data = np.asarray(data / data[self.gtab.b0s_mask].mean())
> /Library/Python/2.7/site-packages/dipy/reconst/mapmri_pa.py:413:
> UserWarning: Optimization did not find a solution
>   warn('Optimization did not find a solution')
> /Library/Python/2.7/site-packages/dipy/reconst/mapmri_pa.py:444:
> UserWarning: Optimization did not find a solution
>   warn('Optimization did not find a solution')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/Library/Python/2.7/site-packages/dipy/reconst/multi_voxel.py",
> line 33, in new_fit
>     fit_array[ijk] = single_voxel_fit(self, data[ijk])
>   File "/Library/Python/2.7/site-packages/dipy/reconst/mapmri_pa.py",
> line 465, in fit
>     coef_iso = coef_iso / sum(coef_iso * self.Bm_iso)
> UnboundLocalError: local variable 'coef_iso' referenced before assignment
>
>
> Any suggestions?
>
> Thank you.
>
> ping
>
> On Fri, Jan 12, 2018 at 6:24 PM, Rutger Fick <fick.rutger at gmail.com>
> wrote:
>
>> Hi Ping,
>>
>> Attached is the mapmri code that also has PA, just put it in the
>> dipy/reconst/ folder (where also the current mapmri.py file is) and run
>> "python setup.py install" from dipy's main folder. That should make it
>> usable in the same way as the current mapmri module.
>> Note that its based on an old implementation that still works with the
>> "cvxopt" optimizer package, so you'll have to install cvxopt to make it run.
>>
>> I recommend you use the model with both laplacian regularization and
>> positivity constraint, this give the best results in general.
>>
>> from dipy.reconst import mapmri_pa
>> mapmod = mapmri_pa.MapmriModel(gtab,
>>                                laplacian_regularization=True,  # this
>> regularization enhances reproducibility of estimated q-space indices by
>> imposing smoothness
>>                                laplacian_weighting="GCV",  # this makes
>> it use generalized cross-validation to find the best regularization weight
>>                                positivity_constraint=True)  # this
>> ensures the estimated PDF is positive
>> mapfit = mapmod.fit(data)
>> pa = mapfit.pa()
>>
>> Aside from the original MAPMRI citation for Ozarslan et al. (2013), note
>> that the relevant citation for dipy's laplacian-regularized MAP-MRI
>> implementation is [1].
>> [1] Fick, Rutger HJ, et al. "MAPL: Tissue microstructure estimation using
>> Laplacian-regularized MAP-MRI and its application to HCP data."
>> *NeuroImage* 134 (2016): 365-385.
>>
>> Hope it helps and let me know if you need anything else,
>> Rutger
>>
>>
>> On 12 January 2018 at 21:48, Ping-Hong Yeh <pinghongyeh at gmail.com> wrote:
>>
>>> Hi Roger,
>>>
>>> Thanks for the prompt reply.
>>> May I have the code for estimating PA?
>>>
>>> Ping
>>>
>>> On Jan 12, 2018 3:21 PM, "Rutger Fick" <fick.rutger at gmail.com> wrote:
>>>
>>>> Hi Ping,
>>>>
>>>> MAPL is just a name for using laplacian-regularized MAP-MRI. If you're
>>>> using the dipy mapmri implementation then you're using MAPL by default.
>>>> From a fitted mapmri model you can estimate overall non-gaussianity
>>>> using fitted_model.ng(), and parallel and perpendicular non-Gaussianity
>>>> using ng_parallel() and ng_perpendicperpendicularular().
>>>> Propagator Anisotropic is not included in the current dipy
>>>> implementation. However, I do have a personal version of dipy's mapmri
>>>> implementation that includes it, if you're interested.
>>>>
>>>> Best,
>>>> Rutger
>>>>
>>>> On 12 January 2018 at 16:49, Ping-Hong Yeh <pinghongyeh at gmail.com>
>>>> wrote:
>>>>
>>>>> Hi DIPY users,
>>>>>
>>>>> I would like to know the way of estimating non-Gaussian and PA,
>>>>> mentioned in the Avram et al. “Clinical feasibility of using mean
>>>>> apparent propagator (MAP) MRI to characterize brain tissue microstructure”
>>>>> paper,  using MAPMRI or MAPL model.
>>>>>
>>>>> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20180117/433754e8/attachment.html>


More information about the Neuroimaging mailing list