NiBabel

Access a cacophony of neuro-imaging file formats

Previous topic

nibabel.nifti1.save

This Page

Reggie -- the one

nibabel.nifti1.Nifti1Extension

digraph inheritanceb97e366553 { rankdir=LR; ratio=compress; fontsize=14; size="6.0, 8.0"; "Nifti1Extension" [shape=ellipse,URL="#nibabel.nifti1.Nifti1Extension",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; }

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.

Methods

get_code
get_content
get_sizeondisk
write_to
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.

Methods

get_code
get_content
get_sizeondisk
write_to
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 :