Matlab Help Index Technical Documentation Index

read_label

NAME ^

function [comment, num_vertices, values] = read_label(label)

SYNOPSIS ^

function [comment, num_vertices, values] = read_label(label)

DESCRIPTION ^

 function [comment, num_vertices, values] = read_label(label)

 Reads a FS-FAST label (with filename label) and retrieves:

 comment: the first line in the file, stating that it is an ASCII
 label and giving the subjectname

 num_vertices: the second line in the file, giving the total number
 of vertices in the label

 values: actual vertices included in the label, in the format
 vertex xcoord ycoord zcoord label_value

 This function is part of froi, FS-FAST ROI, and is available from
 http://froi.sourceforge.net and is available under the Artistic License.

 $Id: read_label.m,v 1.2 2003/08/21 16:22:40 nknouf Exp $

CROSS-REFERENCE INFORMATION ^

This function calls:

This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [comment, num_vertices, values] = read_label(label)
0002 % function [comment, num_vertices, values] = read_label(label)
0003 %
0004 % Reads a FS-FAST label (with filename label) and retrieves:
0005 %
0006 % comment: the first line in the file, stating that it is an ASCII
0007 % label and giving the subjectname
0008 %
0009 % num_vertices: the second line in the file, giving the total number
0010 % of vertices in the label
0011 %
0012 % values: actual vertices included in the label, in the format
0013 % vertex xcoord ycoord zcoord label_value
0014 %
0015 % This function is part of froi, FS-FAST ROI, and is available from
0016 % http://froi.sourceforge.net and is available under the Artistic License.
0017 %
0018 % $Id: read_label.m,v 1.2 2003/08/21 16:22:40 nknouf Exp $
0019 
0020 %% open label
0021 fid = fopen(label,'r');
0022 if (fid == -1)
0023     oops(159);
0024 end
0025 
0026 %% read in label
0027 comment = fgetl(fid);
0028 num_vertices = fscanf(fid, '%d\n',1);
0029 values = fscanf(fid, '%d %f %f %f %f', [5 inf]);
0030 
0031 %% transpose values matrix so we have dimensions [num_vertices 5]
0032 values = values';
0033 
0034 return;

Generated at 19:47:41 15-Oct-2003 by m2html © 2003