NiBabel

Access a cacophony of neuro-imaging file formats

Previous topic

nibabel.nicom.dwiparams.B2q

Next topic

nibabel.nicom.structreader

This Page

Reggie -- the one

nibabel.nicom.dwiparams.nearest_pos_semi_def

nibabel.nicom.dwiparams.nearest_pos_semi_def(B)

Least squares positive semi-definite tensor estimation

Reference: Niethammer M, San Jose Estepar R, Bouix S, Shenton M, Westin CF. On diffusion tensor estimation. Conf Proc IEEE Eng Med Biol Soc. 2006;1:2622-5. PubMed PMID: 17946125; PubMed Central PMCID: PMC2791793.

Parameters :

B : (3,3) array-like

B matrix - symmetric. We do not check the symmetry.

Returns :

npds : (3,3) array

Estimated nearest positive semi-definite array to matrix B.

Examples

>>> B = np.diag([1, 1, -1])
>>> nearest_pos_semi_def(B)
array([[ 0.75,  0.  ,  0.  ],
       [ 0.  ,  0.75,  0.  ],
       [ 0.  ,  0.  ,  0.  ]])