Home > bioelectromagnetism > mesh_write.m

mesh_write

PURPOSE ^

mesh_write - a switch yard for several mesh writing functions

SYNOPSIS ^

function [p] = mesh_write(p)

DESCRIPTION ^

 mesh_write - a switch yard for several mesh writing functions
 
 Usage: [p] = mesh_write(p)
 
 p is a parameter structure (see eeg_toolbox_defaults for
 more details). In this function, it should contain mesh data
 in p.mesh.data and the following string fields:
 
       p.mesh.path - the directory location of the file to load
       p.mesh.file - the name of the file to load
       p.mesh.type - the file formats (case insensitive) are:
 
                    'emse'
                    'brainstorm'
                    'ascii' or 'freesurfer' for *.asc file
                    'fs_surf' for freesurfer binary surface
                    'fs_curv' for freesurfer binary curvature
                    'fs_overlay' for freesurfer binary overlay (.w)
 
 If you have a file format you would like supported, please email
 the author with an example and description of the format.  The 
 file formats supported here are described in more detail at 
 their respective websites:
 
       EMSE:       http://www.sourcesignal.com
       BrainStorm: http://neuroimage.usc.edu/brainstorm/
       FreeSurfer: http://surfer.nmr.mgh.harvard.edu/
 
 See also, mesh_open, mesh_write_emse,
           mesh_write_brainstorm, mesh_write_freesurfer
           mesh_write_fs_surf, mesh_write_fs_curv,
           mesh_write_fs_overlay

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [p] = mesh_write(p)
0002 
0003 % mesh_write - a switch yard for several mesh writing functions
0004 %
0005 % Usage: [p] = mesh_write(p)
0006 %
0007 % p is a parameter structure (see eeg_toolbox_defaults for
0008 % more details). In this function, it should contain mesh data
0009 % in p.mesh.data and the following string fields:
0010 %
0011 %       p.mesh.path - the directory location of the file to load
0012 %       p.mesh.file - the name of the file to load
0013 %       p.mesh.type - the file formats (case insensitive) are:
0014 %
0015 %                    'emse'
0016 %                    'brainstorm'
0017 %                    'ascii' or 'freesurfer' for *.asc file
0018 %                    'fs_surf' for freesurfer binary surface
0019 %                    'fs_curv' for freesurfer binary curvature
0020 %                    'fs_overlay' for freesurfer binary overlay (.w)
0021 %
0022 % If you have a file format you would like supported, please email
0023 % the author with an example and description of the format.  The
0024 % file formats supported here are described in more detail at
0025 % their respective websites:
0026 %
0027 %       EMSE:       http://www.sourcesignal.com
0028 %       BrainStorm: http://neuroimage.usc.edu/brainstorm/
0029 %       FreeSurfer: http://surfer.nmr.mgh.harvard.edu/
0030 %
0031 % See also, mesh_open, mesh_write_emse,
0032 %           mesh_write_brainstorm, mesh_write_freesurfer
0033 %           mesh_write_fs_surf, mesh_write_fs_curv,
0034 %           mesh_write_fs_overlay
0035 %
0036 
0037 % $Revision: 1.1 $ $Date: 2004/11/12 01:32:35 $
0038 
0039 % Licence:  GNU GPL, no express or implied warranties
0040 % History:  02/2002 Darren.Weber_at_radiology.ucsf.edu
0041 %
0042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0043 
0044 
0045 if ~exist('p','var'),
0046     msg = sprintf('\nMESH_WRITE...no input p struct.\n');
0047     error(msg);
0048 elseif isempty(p),
0049     msg = sprintf('\nMESH_WRITE...input p struct is empty.\n');
0050     error(msg);
0051 elseif isempty(p.mesh.data),
0052     msg = sprintf('\nMESH_WRITE...input p struct has no mesh data.\n');
0053     error(msg);
0054 end
0055 
0056 type = lower(p.mesh.type);
0057 
0058 switch type,
0059     
0060 case 'emse',
0061     
0062     mesh_write_emse(p);
0063     
0064 case 'brainstorm',
0065     
0066     mesh_write_brainstorm(p);
0067     
0068 case {'ascii','freesurfer'}, % for *.asc file
0069     
0070     mesh_write_freesurfer(p);
0071     
0072 case 'fs_surf', % for freesurfer binary surface
0073     
0074     mesh_write_fs_surf(p);
0075     
0076 case 'fs_curv', % for freesurfer binary curvature
0077     
0078     mesh_write_fs_curv(p);
0079     
0080 case 'fs_overlay', % for freesurfer binary overlay (.w)
0081     
0082     mesh_write_fs_overlay(p);
0083     
0084 otherwise,
0085     fprintf('...mesh format: %s\n', p.mesh.type);
0086     fprintf('...sorry, cannot write this data format at present.\n');
0087     return;
0088 end
0089 
0090 return

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