NiBabel

Access a cacophony of neuro-imaging file formats

Previous topic

nibabel.trackvis.aff_to_hdr

Next topic

nibabel.trackvis.read

Reggie -- the one

nibabel.trackvis.empty_header

nibabel.trackvis.empty_header(endianness=None, version=2)

Empty trackvis header

Parameters :

endianness : {‘<’,’>’}, optional

Endianness of empty header to return. Default is native endian.

version : int, optional

Header version. 1 or 2. Default is 2

Returns :

hdr : structured array

structured array containing empty trackvis header

Notes

The trackvis header can store enough information to give an affine mapping between voxel and world space. Often this information is missing. We make no attempt to fill it with sensible defaults on the basis that, if the information is missing, it is better to be explicit.

Examples

>>> hdr = empty_header()
>>> print hdr['version']
2
>>> np.asscalar(hdr['id_string']) #23dt next : bytes
'TRACK'
>>> endian_codes[hdr['version'].dtype.byteorder] == native_code
True
>>> hdr = empty_header(swapped_code)
>>> endian_codes[hdr['version'].dtype.byteorder] == swapped_code
True
>>> hdr = empty_header(version=1)
>>> print hdr['version']
1