svreg: Analyzing Output with MATLAB

It is possible to analyze the output files of SVReg using MATLAB.

Reading cortical thickness information:

Vertex-wise cortical thickness calculations (in mm) are stored in the attributes field of the mid.cortex.reg.dfs files produced by SVReg. To access this information, use the MATLAB function readdfs.m (available here).

Vertex-wise cortical thickness of subject fileprefix‘s hemi hemisphere
surface=readdfs(‘fileprefix.hemi.mid.cortex.svreg’);
thickness=surface.attributes;
Vertex-wise cortical thickness of subject fileprefix‘s hemi mapped to the atlas brain
surface = readdfs(‘fileprefix.target.hemi.mid.cortex.reg’);
mapped_thickness = surface.attributes;

Using the thickness mapped to the atlas brain allows for comparison between subjects and/or scans.

Note that readdfs.m gives you access to the fields described in the DFS format page, in particular the label values. Thus, if you want to only look at a particular ROI, you can look up the numerical index ID in the brainsuite_labeldescription.xml file (located in the subject’s directory after running SVReg), find the index of the vertices with that label, and then look at only their thicknesses.

surface = readdfs(‘fileprefix.target.hemi.mid.cortex.reg’);
roi = find(surface.labels == label_id);
mapped_thickness = surface.attributes(roi);

Reading volume files:

The volume files used and generated by SVReg are stored in zipped NIfTI format. They can be read into MATLAB by unzipping and using the tools found at http://www.rotman-baycrest.on.ca/~jimmy/NIFTI/ (mainly, load_nii.m). For instance, to load the warped atlas file, you would use

gunzip(‘fileprefix.svreg.nii.gz’);
nii_volume = load_nii(‘fileprefix.svreg.nii’);
delete(‘fileprefix.svreg.nii’);

Note that the last command deletes the unzipped NIFTI image and can be omitted if you wish to keep it. load_nii.m generates a MATLAB structure containing information about the file and the image itself (stored in the variable nii_volume.img in the above example).