Home > vbmeg > vbmeg.m

vbmeg

PURPOSE ^

This function is an environmental configuration file of VBMEG.

SYNOPSIS ^

function [varargout] = vbmeg(command, arg1)

DESCRIPTION ^

 This function is an environmental configuration file of VBMEG. 
 Usage:
  vbmeg('command', arg1)
 [command]
   'set_path'   : (default)set program directories to MATLAB path.
                : Path is added found by which('vbmeg') command.
   'version'    : display current vbmeg version
   'set_global' : only set global constant values
   'save_version' : set saving version
                  : This command requires 'arg1'.
                  : The 'arg1' is given the save command as a version option.
                  :  e.g. '-v6' '-v7.3' ['']
   'vb_rc_file' : return vbmeg resource filename.

 [history]
   200X-XX-XX (Hayashi) initial version
   2008-01-25 (Sako) changed '-version' to 'version' and added 'set_global'
   2009-07-06 (Sako) added 'save_version' command

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [varargout] = vbmeg(command, arg1)
0002 % This function is an environmental configuration file of VBMEG.
0003 % Usage:
0004 %  vbmeg('command', arg1)
0005 % [command]
0006 %   'set_path'   : (default)set program directories to MATLAB path.
0007 %                : Path is added found by which('vbmeg') command.
0008 %   'version'    : display current vbmeg version
0009 %   'set_global' : only set global constant values
0010 %   'save_version' : set saving version
0011 %                  : This command requires 'arg1'.
0012 %                  : The 'arg1' is given the save command as a version option.
0013 %                  :  e.g. '-v6' '-v7.3' ['']
0014 %   'vb_rc_file' : return vbmeg resource filename.
0015 %
0016 % [history]
0017 %   200X-XX-XX (Hayashi) initial version
0018 %   2008-01-25 (Sako) changed '-version' to 'version' and added 'set_global'
0019 %   2009-07-06 (Sako) added 'save_version' command
0020 %
0021 % Copyright (C) 2011, ATR All Rights Reserved.
0022 % License : New BSD License(see VBMEG_LICENSE.txt)
0023 
0024 if ~exist('command', 'var')
0025     command = 'set_path';
0026 end
0027 
0028 global vbmeg_inst
0029 global vbmeg_saving_version
0030 global reduce_algorithm;
0031 
0032 reduce_algorithm = 'CGAL'; % reduce algorythm used in vb_reducepatch
0033                            % = 'MATLAB' : MATLAB reducepatch is used.
0034                            % = 'CGAL'   : CGAL is used.
0035 
0036 switch(command)
0037 case 'set_path'
0038     prog_file = which('vbmeg.m');
0039     ix = findstr(prog_file,filesep);
0040     prog_dir = prog_file(1:ix(end));
0041     disp('--- Find VBMEG program directory'); 
0042     fprintf('VBMEG program directory: %s\n',prog_dir);
0043 
0044     %vbmeg_home_dir = vb_set_prog_dir(prog_dir);
0045     vbmeg_home_dir = prog_dir;
0046     addpath(vbmeg_home_dir);
0047     addpath(genpath(fullfile(vbmeg_home_dir, 'external')));
0048     addpath(genpath(fullfile(vbmeg_home_dir, 'functions')));
0049     addpath(genpath(fullfile(vbmeg_home_dir, 'standard_brain')));
0050 
0051 %     global vbmeg_inst
0052 
0053     disp('--- Set program directories to MATLAB path');
0054     vbmeg_inst.const = vb_define_set(vbmeg_home_dir);
0055     
0056     verbose_const = vb_define_verbose;
0057     vbmeg_inst.verbose_level = verbose_const.VERBOSE_LEVEL_NOTICE;
0058 
0059     disp('--- Create global variable ''vbmeg_inst''')
0060 
0061   case 'version'
0062     [major, minor, alpha_beta, rev] = vb_version;
0063     ver_str = sprintf('%.1f-%d.%c.%d', major, minor, alpha_beta, rev);
0064     % disp(ver_str);
0065     varargout{1} = ver_str; % return version string
0066     
0067   case 'set_global'
0068     vbmeg_inst.const = vb_define_set;
0069     disp('--- Create global variable ''vbmeg_inst''')
0070     
0071   case 'save_version'
0072     if ~exist('arg1', 'var') || isempty(arg1)
0073       vbmeg_saving_version = '';
0074       disp('VBMEG Save format reset to : system setting.');
0075     elseif (strcmpi(arg1, '-v6') || strcmpi(arg1, '-v7') || strcmpi(arg1, '-v7.3') || ...
0076        (vb_matlab_version('>=', '9.2') && strcmpi(arg1, '-v7.3 -nocompression')) )
0077       fprintf('VBMEG Save format set to : %s\n', arg1);
0078       vbmeg_saving_version = arg1;
0079     else
0080         if vb_matlab_version('>=', '9.2')
0081             error('save_version : ''-v6'' or ''-v7'' or ''-v7.3'', ''-v7.3 -nocompression''');
0082         else
0083             error('save_version : ''-v6'' or ''-v7'' or ''-v7.3''');
0084         end
0085     end
0086   case 'vb_rc_file'
0087     varargout{1} = fullfile(vb_get_file_parts(which('vbmeg.m')), 'vbmegrc');
0088   otherwise
0089     error('Unknown command: %s', command);  
0090         
0091 end
0092 
0093 % for CGAL module
0094 iso2mesh_dir = fileparts(which('cgalsurf'));
0095 if ~ispc
0096     iso2mesh_bin = fullfile(iso2mesh_dir, '*.*');
0097     cmd = ['chmod 755 ' iso2mesh_bin];
0098     system(cmd);
0099 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005