Home > bioelectromagnetism > freesurfer_plot_curv.m

freesurfer_plot_curv

PURPOSE ^

freesurfer_plot_curv - create a patch surface colored by curvature

SYNOPSIS ^

function [Hf,Hp] = freesurfer_plot_curv(surf,curv)

DESCRIPTION ^

 freesurfer_plot_curv - create a patch surface colored by curvature

 [Hf,Hp] = freesurfer_plot_curv(surf,curv)

 surf is a struct returned by freesurfer_read_surf, it contains faces and
 vertex coordinates (Nx3, Cartesian xyz).
 curv is an array of Nx1 potential values or Nx3 RGB values
 [Hf,Hp] is a handle to the figure and patch object, respectively

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Hf,Hp] = freesurfer_plot_curv(surf,curv)
0002 
0003 % freesurfer_plot_curv - create a patch surface colored by curvature
0004 %
0005 % [Hf,Hp] = freesurfer_plot_curv(surf,curv)
0006 %
0007 % surf is a struct returned by freesurfer_read_surf, it contains faces and
0008 % vertex coordinates (Nx3, Cartesian xyz).
0009 % curv is an array of Nx1 potential values or Nx3 RGB values
0010 % [Hf,Hp] is a handle to the figure and patch object, respectively
0011 %
0012 
0013 % $Revision: 1.2 $ $Date: 2005/07/05 23:36:39 $
0014 
0015 % Copyright (C) 2000  Darren L. Weber
0016 %
0017 % This program is free software; you can redistribute it and/or
0018 % modify it under the terms of the GNU General Public License
0019 % as published by the Free Software Foundation; either version 2
0020 % of the License, or (at your option) any later version.
0021 %
0022 % This program is distributed in the hope that it will be useful,
0023 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0024 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0025 % GNU General Public License for more details.
0026 %
0027 % You should have received a copy of the GNU General Public License
0028 % along with this program; if not, write to the Free Software
0029 % Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
0030 % USA.
0031 
0032 % History:  04/2005, Darren.Weber_at_radiology.ucsf.edu
0033 %
0034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0035 
0036 ver = '$Revision: 1.2 $ $Date: 2005/07/05 23:36:39 $';
0037 fprintf('FREESURFER_PLOT_CURV [v %s]\n',ver(11:15));
0038 
0039 if size(curv,2) == 3,
0040     % we have RGB colors that must be scaled between 0 and 1
0041     a = 0; b = 1;
0042     curv = (curv+1)*(b-a)/2+a;
0043 end
0044 
0045 %curvZ = (curv - mean(curv)) ./ std(curv)
0046 
0047 %posCurvIndex = find(curv >= 0);
0048 %negCurvIndex = setdiff(1:length(curv),posCurvIndex);
0049 %curv(posCurvIndex) = 1;
0050 %curv(negCurvIndex) = -1;
0051 
0052 Hf = figure; hold on
0053 Hp = patch('vertices',surf.vertices,'faces',surf.faces,...
0054     'FaceVertexCData',curv,...
0055     'facecolor','interp',...
0056     'edgecolor','none');
0057 daspect([1,1,1])
0058 
0059 set(gca,'CLim',[-1.2 1.2]);
0060 colormap(flipud(gray(20)));
0061 colorbar
0062 
0063 material dull
0064 lighting phong
0065 
0066 axis off
0067 rotate3d
0068 
0069 return

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003