This GIfTI library allows to handle the GIfTI Geometry file format from the Neuroimaging Informatics Technology Initiative (NIfTI) using a MATLAB/Octave class:
It relies on external libraries:
Note that these tools are already included in the GIfTI library provided here, so you don't need to install them separately.
There are import facilities from FreeSurfer, VTK, Wavefront OBJ, Stanford PLY, STL and MZ3 file formats.
There are export facilities to VTK, Collada, IDTF, Wavefront OBJ and JS/JSON (for Plotly) file formats.
This library is also part of SPM.
MATLAB R2007a or above is required to use most of the features of this toolbox. GNU Octave is also supported.
All the code is embedded in a @gifti
class. To install it, all you need is to
make sure that the directory containing @gifti
is in MATLAB path:
addpath /home/login/Documents/MATLAB/gifti
The library relies on a number of C-MEX files (zstream
, base64
, xml_parser
).
Compiled versions for 64 bit MATLAB on Windows, Linux and Mac are provided
but they can easily be compiled by yourself otherwise, see @gifti/private/Makefile
.
In the following, we use the files contained in BV_GIFTI.tar.gz
(BrainVISA examples),
available from the NITRC website:
% Read the GIfTI surface file
g = gifti('sujet01_Lwhite.surf.gii')
% Read the GIfTI shape file
c = gifti('sujet01_Lwhite.shape.gii')
% Display mesh
figure; plot(g);
% Display mesh with curvature
figure; plot(g,c);
In a similar way, a gifti
object can be created from an extracted isosurface from volume data and saved to a file:
load mri % an example dataset available in MATLAB
D = squeeze(D);
Ds = smooth3(D);
g = gifti(isosurface(Ds,5))
h = plot(g);
daspect([1,1,.4]); view(45,30); axis tight
lightangle(45,30);
set(h,'SpecularColorReflectance',0,'SpecularExponent',50)
save(g,'mri.surf.gii','Base64Binary');