Home > functions > tool_box > mri_toolbox > mri_point_select_dir > mps_fileio > vb_mps_fileio_write.m

vb_mps_fileio_write

PURPOSE ^

mps_File(.mps.mat) output.

SYNOPSIS ^

function [result] = vb_mps_fileio_write(obj, output_file)

DESCRIPTION ^

 mps_File(.mps.mat) output.
 [USAGE]
    [result] = vb_mps_fileio_write(<obj>, <output_file>);
 [IN]
    output_file : output filename
 [OUT]
    result : SUCESS or FAILURE


 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 [result] = vb_mps_fileio_write(obj, output_file)
0002 % mps_File(.mps.mat) output.
0003 % [USAGE]
0004 %    [result] = vb_mps_fileio_write(<obj>, <output_file>);
0005 % [IN]
0006 %    output_file : output filename
0007 % [OUT]
0008 %    result : SUCESS or FAILURE
0009 %
0010 %
0011 % Copyright (C) 2011, ATR All Rights Reserved.
0012 % License : New BSD License(see VBMEG_LICENSE.txt)
0013 if ~exist('obj', 'var'), error('obj is a required parameter'); end
0014 if ~exist('output_file', 'var') || isempty(output_file)
0015     error('output_file is a required parameter');
0016 end
0017 
0018 global vbmeg_inst;
0019 
0020 result = SUCCESS;
0021 
0022 Analyzeinfo = obj.analyze_info;
0023 Pointlist = cell(0);
0024 
0025 %
0026 % --- Formatting data
0027 %
0028 Vdim  = Analyzeinfo.Vdim;
0029 Vsize = Analyzeinfo.Vsize;
0030 const = vbmeg_inst.const;
0031 
0032 NPoints = vb_mps_pointlist_get_pointnum(obj.point_list);
0033 
0034 for k=1:NPoints
0035     [name, point] = vb_mps_pointlist_get_point(obj.point_list, k);
0036 
0037     point_mri = vb_analyze_right_to_spm_right(point.voxels, Vdim, Vsize);
0038 
0039     s = struct('coord_type', const.COORDINATE_SPM_RIGHT_M, ...
0040                'name', name, ...
0041                'point', point_mri);
0042     % Converted to SPM_Right m
0043     Pointlist{k} = s;
0044     % Base data
0045     Base{k}.name  = name;
0046     Base{k}.point = point;
0047 end
0048 
0049 % Save mps file (Overwrite mode)
0050 vb_fsave(output_file, 'Analyzeinfo', 'Pointlist', 'Base');

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005