@importer('<STR_LIT>', ('<STR_LIT>', '<STR_LIT>'))<EOL>def load_gifti(filename, to='<STR_LIT>'):
dat = nib.load(filename)<EOL>to = '<STR_LIT>' if to is None else to.lower()<EOL>if to in ['<STR_LIT>', '<STR_LIT:image>', '<STR_LIT>', '<STR_LIT:all>', '<STR_LIT>']:<EOL><INDENT>return dat<EOL><DEDENT>if to in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>pset = dat.get_arrays_from_intent('<STR_LIT>')<EOL>tris = dat.get_arrays_from_intent('<STR_LIT>')<EOL>if len(pset) == <NUM_LIT:1> and len(tris) == <NUM_LIT:1>:<EOL><INDENT>(cor, tri) = (pset[<NUM_LIT:0>].data, tris[<NUM_LIT:0>].data)<EOL>try: return Mesh(tri, cor)<EOL>except Exception: pass<EOL><DEDENT>elif len(pset) == <NUM_LIT:1> and len(tris) == <NUM_LIT:0>:<EOL><INDENT>return pset[<NUM_LIT:0>].data<EOL><DEDENT>elif len(tris) == <NUM_LIT:1> and len(pset) == <NUM_LIT:0>:<EOL><INDENT>return Tesselation(tris[<NUM_LIT:0>].data)<EOL><DEDENT>stats = [v for k in range(<NUM_LIT:2>,<NUM_LIT>) for v in dat.get_arrays_from_intent(k)]<EOL>if len(stats) == <NUM_LIT:1>: return np.squeeze(stats[<NUM_LIT:0>].data)<EOL>if len(dat.darrays) == <NUM_LIT:1>: return np.squeeze(dat.darrays[<NUM_LIT:0>].data)<EOL>return dat<EOL><DEDENT>elif to in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>cor = dat.darrays[<NUM_LIT:0>].data<EOL>if pimms.is_matrix(cor, np.inexact): return cor<EOL>else: raise ValueError('<STR_LIT>')<EOL><DEDENT>elif to in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>cor = dat.darrays[<NUM_LIT:0>].data<EOL>if pimms.is_matrix(cor, '<STR_LIT:int>'): return Tesselation(cor)<EOL>else: raise ValueError('<STR_LIT>')<EOL><DEDENT>elif to in ['<STR_LIT>']:<EOL><INDENT>if len(dat.darrays) == <NUM_LIT:2>: (cor,    tri) = dat.darrays<EOL>else:                     (cor, _, tri) = dat.darrays<EOL>cor = cor.data<EOL>tri = tri.data<EOL>if pimms.is_matrix(tri, np.inexact) and pimms.is_matrix(cor, '<STR_LIT:int>'):<EOL><INDENT>(cor,tri) = (tri,cor)<EOL><DEDENT>return Mesh(tri, cor)<EOL><DEDENT>else: raise ValueError('<STR_LIT>')<EOL>
load_gifti(filename) yields the nibabel gifti data structure loaded by nibabel from the given
  filename. Currently, this load method is not particlarly sophisticated and simply returns this
  data.

The optional argument to may be used to coerce the resulting data to a particular format; the
following arguments are understood:
  * 'auto' currently returns the nibabel data structure.
  * 'mesh' returns the data as a mesh, assuming that there are two darray elements stored in the
    gifti file, the first of which must be a coordinate matrix and a triangle topology.
  * 'coordinates' returns the data as a coordinate matrix.
  * 'tesselation' returns the data as a tesselation object.
  * 'raw' returns the entire gifti image object (None will also yield this result).