GIfTI format IO
giftiio | |
gifti |
Classes defining Gifti objects
The Gifti specification was (at time of writing) available as a PDF download from http://www.nitrc.org/projects/gifti/
GiftiCoordSystem([dataspace, xformspace, xform]) | Gifti coordinate system transform matrix |
GiftiDataArray([data, intent, datatype, ...]) | Container for Gifti numerical data array and associated metadata |
GiftiImage([header, extra, file_map, meta, ...]) | GIFTI image object |
GiftiLabel([key, red, green, blue, alpha]) | Gifti label: association of integer key with optional RGBA values |
GiftiLabelTable() | Gifti label table: a sequence of key, label pairs |
GiftiMetaData([nvpair]) | A sequence of GiftiNVPairs containing metadata for a gifti data array |
GiftiNVPairs([name, value]) | Gifti name / value pairs |
data_tag(*args, **kwargs) | data_tag is an internal API that will be discontinued. |
read(*args, **kwargs) | Load a Gifti image from a file |
write(*args, **kwargs) | Save the current image to a new file |
GiftiImageParser([encoding, buffer_size, ...]) | |
GiftiParseError | Gifti-specific parsing error |
Outputter(*args, **kwargs) | Outputter class deprecated. |
parse_gifti_file(*args, **kwargs) | parse_gifti_file deprecated. Use GiftiImageParser.parse() instead. |
read_data_block(encoding, endian, ordering, ...) | Tries to unzip, decode, parse the funny string data |
Bases: nibabel.xmlutils.XmlSerializable
Gifti coordinate system transform matrix
Quotes are from the gifti spec dated 2011-01-14.
“For a DataArray with an Intent NIFTI_INTENT_POINTSET, this element describes the stereotaxic space of the data before and after the application of a transformation matrix. The most common stereotaxic space is the Talairach Space that places the origin at the anterior commissure and the negative X, Y, and Z axes correspond to left, posterior, and inferior respectively. At least one CoordinateSystemTransformMatrix is required in a DataArray with an intent of NIFTI_INTENT_POINTSET. Multiple CoordinateSystemTransformMatrix elements may be used to describe the transformation to multiple spaces.”
Attributes
Bases: nibabel.xmlutils.XmlSerializable
Container for Gifti numerical data array and associated metadata
Quotes are from the gifti spec dated 2011-01-14.
Attributes
Returns a shell object that cannot be saved.
Returns a shell object that cannot be saved.
Creates a new Gifti data array
from_array method is deprecated. Please use GiftiDataArray constructor instead.
Parameters: | darray : ndarray
intent : string
datatype : None or string, optional
encoding : string, optionaal
endian : string, optional
coordsys : GiftiCoordSystem, optional
ordering : string, optional
meta : None or dict, optional
|
---|---|
Returns: | da : instance of our own class |
get_metadata method deprecated. Use the metadata property instead.2.1
Returns metadata as dictionary
to_xml_close method deprecated. Use the to_xml() function instead.
to_xml_open method deprecated. Use the to_xml() function instead.
Bases: nibabel.xmlutils.XmlSerializable, nibabel.filebasedimages.FileBasedImage
GIFTI image object
The Gifti spec suggests using the following suffixes to your filename when saving each specific type of data:
The Gifti file is stored in endian convention of the current machine.
Adds a data array to the GiftiImage
Parameters: | dataarr : GiftiDataArray instance |
---|
Load a Gifti image from a file_map
Parameters: | file_map : dict
|
---|---|
Returns: | img : GiftiImage |
getArraysFromIntent method deprecated. Use get_arrays_from_intent instead.
Return list of GiftiDataArray elements matching given intent
get_labeltable method deprecated. Use the gifti_img.labeltable property instead.
get_meta method deprecated. Use the gifti_img.meta property instead.
alias of GiftiImageParser
Removes the ith data array element from the GiftiImage
Removes all the data arrays with the given intent type
set_labeltable method deprecated. Use the gifti_img.labeltable property instead.
set_meta method deprecated. Use the gifti_img.meta property instead.
Save the current image to the specified file_map
Parameters: | file_map : dict
|
---|---|
Returns: | None : |
Return XML corresponding to image content
Bases: nibabel.xmlutils.XmlSerializable
Gifti label: association of integer key with optional RGBA values
Quotes are from the gifti spec dated 2011-01-14.
Notes
freesurfer examples seem not to conform to datatype “NIFTI_TYPE_RGBA32” because they are floats, not 4 8-bit integers.
Attributes
get_rgba method deprecated. Use the rgba property instead.2.1
Returns RGBA as tuple
Bases: nibabel.xmlutils.XmlSerializable
Gifti label table: a sequence of key, label pairs
Bases: nibabel.xmlutils.XmlSerializable
A sequence of GiftiNVPairs containing metadata for a gifti data array
get_metadata method deprecated. Use the metadata property instead.2.1
Returns metadata as dictionary
data_tag is an internal API that will be discontinued.
Load a Gifti image from a file
giftiio.read function deprecated. Use nibabel.load() instead.
Parameters: | filename : string
|
---|---|
Returns: | img : GiftiImage
|
Save the current image to a new file
giftiio.write function deprecated. Use nibabel.load() instead.
Parameters: | image : GiftiImage
filename : string
|
---|---|
Returns: | None : |
Notes
We write all files with utf-8 encoding, and specify this at the top of the XML file with the encoding attribute.
The Gifti spec suggests using the following suffixes to your filename when saving each specific type of data:
The Gifti file is stored in endian convention of the current machine.
Bases: nibabel.xmlutils.XmlParser
Collect character data chunks pending collation
The parser breaks the data up into chunks of size depending on the buffer_size of the parser. A large bit of character data, with standard parser buffer_size (such as 8K) can easily span many calls to this function. We thus collect the chunks and process them when we hit start or end tags.
Collate and process collected character data
True if there is character data pending for processing
Bases: nibabel.gifti.parse_gifti_fast.GiftiImageParser
Outputter class deprecated. Use GiftiImageParser instead.
Outputter class deprecated. Use GiftiImageParser instead.
Initialize outputter