Home > vbmeg > functions > device > vivid > vb_read_vivid_mgf.m

vb_read_vivid_mgf

PURPOSE ^

Read VIVID Image from MGF file

SYNOPSIS ^

function [Coord] = vb_read_vivid_mgf(fname,mode)

DESCRIPTION ^

 Read VIVID Image from MGF file
 --- Input
 fname.Left  = [dir subj '_left_non_reduce_MGF.mgf' ];
 fname.Right = [dir subj '_right_non_reduce_MGF.mgf'];
 fname.Front = [dir subj '_front_non_reduce_MGF.mgf'];

 coord_mode = 0 座標変換無し
 coord_mode = 1; VIVID -> SPM-R
  Vivid original format
   X: 右->左
   Y: 下->上
   Z: 後->前
  SPM-R
   X: 左->右
   Y: 後->前
   Z: 下->上
 --- Output
 Coord : Left / Right /Front  head coordinate
  'non_reduce_MGF'- File
        .LV   / .RV   / .FV   : 3D-Coordinate   : [Npoint 3]  [m]
        .LF   / .RF   / .FF   : Patch index     : [Npatch 4]
        .Limg / .Rimg / .Fimg : 3D RGB image    : [Npoint 3]

 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    [Coord] = vb_read_vivid_mgf(fname,mode)
0002 % Read VIVID Image from MGF file
0003 % --- Input
0004 % fname.Left  = [dir subj '_left_non_reduce_MGF.mgf' ];
0005 % fname.Right = [dir subj '_right_non_reduce_MGF.mgf'];
0006 % fname.Front = [dir subj '_front_non_reduce_MGF.mgf'];
0007 %
0008 % coord_mode = 0 座標変換無し
0009 % coord_mode = 1; VIVID -> SPM-R
0010 %  Vivid original format
0011 %   X: 右->左
0012 %   Y: 下->上
0013 %   Z: 後->前
0014 %  SPM-R
0015 %   X: 左->右
0016 %   Y: 後->前
0017 %   Z: 下->上
0018 % --- Output
0019 % Coord : Left / Right /Front  head coordinate
0020 %  'non_reduce_MGF'- File
0021 %        .LV   / .RV   / .FV   : 3D-Coordinate   : [Npoint 3]  [m]
0022 %        .LF   / .RF   / .FF   : Patch index     : [Npatch 4]
0023 %        .Limg / .Rimg / .Fimg : 3D RGB image    : [Npoint 3]
0024 %
0025 % Copyright (C) 2011, ATR All Rights Reserved.
0026 % License : New BSD License(see VBMEG_LICENSE.txt)
0027 
0028 % 2006/2/2  M. Sato
0029 
0030 if ~exist('mode','var'), mode = 1; end;
0031 
0032 if isfield(fname ,'Left')
0033     [V, F, img] = vb_read_mgf_file(fname.Left);
0034     
0035     % Change Vivid Right-hand (mm) coord. to Right-hand SPM (m) coord.
0036     V  = vb_vivid_mm_to_spm_right(V,mode);
0037     
0038     Coord.LV   = V  ;
0039     Coord.LF   = F  ;
0040     Coord.Limg = img;
0041     
0042     NPL = size(V,1);
0043     
0044     fprintf('Number of points in vivid 3D-Left-image= %d\n',NPL)
0045 end
0046 
0047 if isfield(fname ,'Right')
0048     [V, F, img] = vb_read_mgf_file(fname.Right);
0049     
0050     % Change Vivid Right-hand (mm) coord. to Right-hand SPM (m) coord.
0051     V  = vb_vivid_mm_to_spm_right(V,mode);
0052     
0053     Coord.RV   = V  ;
0054     Coord.RF   = F  ;
0055     Coord.Rimg = img;
0056     
0057     NPR = size(V,1);
0058     
0059     fprintf('Number of points in vivid 3D-Right-image= %d\n',NPR)
0060 end
0061     
0062 if isfield(fname ,'Front')
0063     [V, F, img] = vb_read_mgf_file(fname.Front);
0064     
0065     % Change Vivid Right-hand (mm) coord. to Right-hand SPM (m) coord.
0066     V  = vb_vivid_mm_to_spm_right(V,mode);
0067     
0068     Coord.FV   = V  ;
0069     Coord.FF   = F  ;
0070     Coord.Fimg = img;
0071     
0072     NPF = size(V,1);
0073     
0074     fprintf('Number of points in vivid 3D-Front-image= %d\n',NPF)
0075 end
0076

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