2d and 3d brain plots
11 Apr 2012
(Updated 11 Dec 2013)
Quickly and easily create 2d and 3d plots of fMRI data.
function = plot_brain3d(x,meta,erode_layers)
%PLOT_BRAIN3D Plot a 3d brain image
% Each voxel is plotted as a colored cube, such that the entire image forms
% a 3d brain.
% Usage: plot_brain3d(x,meta,erode_layers)
% x: a 1 by nvoxels vector of voxel activations
% meta: a struct with the following fields:
% dimx: number of voxels in the x dimension
% dimy: number of voxels in the y dimension
% dimz: number of voxels in the z dimension
% nvoxels: total number of voxels containing brain
% coordToCol: dimx by dimy by dimz matrix of voxel numbers (zeros
% indicate no voxel at the corresponding location)
% colToCoord: nvoxels by 3 matrix of voxel locations
% erode_layers: optional argument specifying how many layers to make much
% more transparent. this allows patterns beneath the surface
% of the brain to be more-easily seen.
% OUTPUTS: [none]
% SEE ALSO: PLOT_BRAIN2D, PLOT_BRAIN3D_ALT, PATCH_3DARRAY, IMERODE
% AUTHOR: Jeremy R. Manning
% CONTACT: email@example.com
% 4-11-12 jrm wrote it.
% 2-22-13 jrm ensure voxels appear as cubes.
% 12-11-13 jrm re-wrote as wrapper to plot_brain3d
if ~exist('erode_layers', 'var')
erode_layers = 0;
img = cmu_to_mat(x, meta);