NiBabel

Access a cacophony of neuro-imaging file formats

Previous topic

nibabel.nifti1.save

Next topic

nibabel.nifti1.Nifti1Extensions

This Page

Reggie -- the one

nibabel.nifti1.Nifti1Extension

Inheritance diagram of Nifti1Extension

class nibabel.nifti1.Nifti1Extension(code, content)

Baseclass for NIfTI1 header extensions.

This class is sufficient to handle very simple text-based extensions, such as comment. More sophisticated extensions should/will be supported by dedicated subclasses.

Parameters :

code : int|str

Canonical extension code as defined in the NIfTI standard, given either as integer or corresponding label (see extension_codes)

content : str

Extension content as read from the NIfTI file header. This content is converted into a runtime representation.

get_code()

Return the canonical extension type code.

get_content()

Return the extension content in its runtime representation.

get_sizeondisk()

Return the size of the extension in the NIfTI file.

write_to(fileobj, byteswap)

Write header extensions to fileobj

Write starts at fileobj current file position.

Parameters :

fileobj : file-like object

Should implement write method

byteswap : boolean

Flag if byteswapping the data is required.

Returns :

None :