Home > bioelectromagnetism > freesurfer_read_annotation.m

freesurfer_read_annotation

PURPOSE ^

freesurfer_read_annotation - reads a binary annotation file into a vector

SYNOPSIS ^

function [annots] = freesurfer_read_annotation(fname)

DESCRIPTION ^

 freesurfer_read_annotation - reads a binary annotation file into a vector

 [annots] = freesurfer_read_annotation(fname)
 
 See also freesurfer_read_surf, freesurfer_read_curv,
          freesurfer_read_wfile

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [annots] = freesurfer_read_annotation(fname)
0002 
0003 % freesurfer_read_annotation - reads a binary annotation file into a vector
0004 %
0005 % [annots] = freesurfer_read_annotation(fname)
0006 %
0007 % See also freesurfer_read_surf, freesurfer_read_curv,
0008 %          freesurfer_read_wfile
0009 %
0010 
0011 % $Revision: 1.2 $ $Date: 2005/05/18 23:07:42 $
0012 
0013 % Licence:  GNU GPL, no implied or express warranties
0014 % History:  07/2004, Darren.Weber_at_radiology.ucsf.edu
0015 %                    adapted from MGH code from Bruce Fischl
0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017 
0018 ver = '$Revision: 1.2 $';
0019 fprintf('FREESURFER_READ_ANNOTATION [v %s]\n',ver(11:15));
0020 
0021 % open it as a big-endian file
0022 fid = fopen(fname, 'rb', 'b');
0023 if (fid < 0),
0024      str = sprintf('could not open annotation file %s.', fname);
0025      error(str);
0026 end
0027 
0028 fprintf('...reading annotation file: %s\n', fname);
0029 tic;
0030 
0031 vnum = fread(fid, 1, 'int32');
0032 tmp = fread(fid, vnum*2, 'int');
0033 annots = tmp(2:2:vnum*2);
0034 
0035 fclose(fid);
0036 t=toc; fprintf('...done (%6.2f sec)\n\n',t);
0037 
0038 return

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