fsl.data.gifti
¶
This class provides classes and functions for working with GIFTI files.
The GIFTI file format specification can be found at http://www.nitrc.org/projects/gifti/
Support is currently very basic - only the following classes/functions are available:
GiftiMesh
Class which represents a GIFTI surface image. loadGiftiMesh
Extracts surface data from the given nibabel.gifti.GiftiImage
.loadGiftiVertexData
Loads vertex data from the given GIFTI file. relatedFiles
Given a GIFTI file, returns a list of other GIFTI files in the same directory which appear to be related with the given one.
-
fsl.data.gifti.
ALLOWED_EXTENSIONS
= ['.surf.gii']¶ List of file extensions that a file containing Gifti surface data is expected to have.
-
fsl.data.gifti.
EXTENSION_DESCRIPTIONS
= ['GIFTI surface file']¶ A description for each of the
ALLOWED_EXTENSIONS
.
-
class
fsl.data.gifti.
GiftiMesh
(infile, fixWinding=False, loadAll=False)¶ Bases:
fsl.data.mesh.Mesh
Class which represents a GIFTI surface image. This is essentially just a 3D model made of triangles.
For each GIFTI surface file that is loaded, the
nibabel.gifti.GiftiImage
instance is stored in theMeta
store, with the absolute path to the surface file as the key.-
loadVertices
(infile, key=None, *args, **kwargs)¶ Overrides the
Mesh.loadVertices()
method.Attempts to load vertices for this
GiftiMesh
from the giveninfile
, which may be a GIFTI file or a plain text file containing vertices.
-
loadVertexData
(infile, key=None)¶ Overrides the
Mesh.loadVertexData()
method.Attempts to load data associated with each vertex of this
GiftiMesh
from the giveninfile
, which may be a GIFTI file or a plain text file which contains vertex data.
-
-
fsl.data.gifti.
loadGiftiMesh
(filename)¶ Extracts surface data from the given
nibabel.gifti.GiftiImage
.The image is expected to contain the following``<DataArray>`` elements:
- one comprising
NIFTI_INTENT_POINTSET
data (the surface vertices) - one comprising
NIFTI_INTENT_TRIANGLE
data (vertex indices defining the triangles).
A
ValueError
will be raised if this is not the case.Parameters: filename – Name of a GIFTI file containing surface data. Returns: A tuple containing these values: - The loaded
nibabel.gifti.GiftiImage
instance - A
(N, 3)
array containingN
vertices. - A
(M, 3))
array containing the vertex indices forM
triangles.
- one comprising
-
fsl.data.gifti.
loadGiftiVertexData
(filename)¶ Loads vertex data from the given GIFTI file.
It is assumed that the given file does not contain any
NIFTI_INTENT_POINTSET
orNIFTI_INTENT_TRIANGLE
data arrays, and which contains either:- One
(M, N)
data array containingN
data points forM
vertices - One or more
(M, 1)
data arrays each containing a single data point forM
vertices, and all with the same intent code
Returns a tuple containing:
- The loaded
nibabel.gifti.GiftiImage
object - A
(M, N)
numpy array containingN
data points forM
vertices
- One
Given a GIFTI file, returns a list of other GIFTI files in the same directory which appear to be related with the given one. Files which share the same prefix are assumed to be related to the given file.
Parameters: - fname – Name of the file to search for related files for
- ftype – If provided, only files with suffixes in this list are searched for. Defaults to files which contain vertex data.
-
class
fsl.data.gifti.
GiftiSurface
(infile, fixWinding=False)¶ Bases:
fsl.data.mesh.TriangleMesh
Deprecated - use GiftiMesh instead.
-
loadVertexData
(dataSource, vertexData=None)¶ Deprecated - use GiftiMesh instead.
Deprecated in 1.6.0, to be removed in 2.0.0. Use GiftiMesh instead
-
-
fsl.data.gifti.
loadGiftiSurface
(filename)¶ Deprecated - use loadGiftiMesh instead.
Deprecated in 1.6.0, to be removed in 2.0.0. Use loadGiftiMesh instead