NiBabel

Access a cacophony of neuro-imaging file formats

Previous topic

nibabel.volumeutils.pretty_mapping

Next topic

nibabel.volumeutils.seek_tell

Reggie -- the one

nibabel.volumeutils.rec2dict

nibabel.volumeutils.rec2dict(rec)

Convert recarray to dictionary

Also converts scalar values to scalars

Parameters :

rec : ndarray

structured ndarray

Returns :

dct : dict

dict with key, value pairs as for rec

Examples

>>> r = np.zeros((), dtype = [('x', 'i4'), ('s', 'S10')])
>>> d = rec2dict(r)
>>> d == {'x': 0, 's': ''} #23dt : replace("''", "b''")
True