AFQ Cortical Meshes


Jump to: navigation, search

The function AFQ_RenderCorticalSurface will render a mesh of a subject's cortical surface from a segmentation image. Vertices of the mesh can be colored based on any scaler value, for example fiber endpoint density. First create a fiber density image for a fiber group:

  % First load in a nifti image that has the same coordinates as the fibers. For example the b0 or t1
  t1Img = readFileNifti('t1.nii.gz');
  % Load the fiber group
  fg = dtiReadFibers('L_Arcuate.mat');
  % Compute a fiber density image. Note that if fg contains multiple fiber groups you should pass in just one (eg. fg(19))
  fdImg = dtiComputeFiberDensityNoGUI(fg, t1Img.qto_xyz, size(, 1);
  % Smooth the image slightly if desired to make the coloring less patchy. 3-5mm usually looks nice
  fdImg = smooth3(fdImg, 'gaussian', 3);
  % Steal the header information from the t1 image and save out the fiber density image = fdImg;
  t1Img.fname = 'L_Arcuate_FiberDensity.nii.gz';
  % Render the cortical surface with a heatmap of fiber density
  cortex = 'path to segmentation.nii.gz';
  overlay = 'path to L_Arcuate_FiberDensity.nii.gz';
  thresh = .01; % Threshold for the overlay image
  crange = [.01 .8]; % Color range of the overlay image
  p = AFQ_RenderCorticalSurface(cortex, 'overlay' , overlay, 'crange', crange, 'thresh', thresh);

If you would like to make a group average fiber density image you can first normalize each subject's fiber group to MNI space (see dtiXformFiberCoords) and make each subject's fiber density image with the header information from the MNI template rather than the individual subject's T1. Then average all the fiber density images, make a mesh from a segmentation of the MNI template and overlay the group average.

Personal tools