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

vb_read_vivid

PURPOSE ^

Read VIVID VRML-Image

SYNOPSIS ^

function [Coord] = vb_read_vivid(fname,mode)

DESCRIPTION ^

 Read VIVID VRML-Image
 --- Input
 fname.Left     = [dir subj '_left_reduce_VRML1.wrl' ];
 fname.Right    = [dir subj '_right_reduce_VRML1.wrl'];
 fname.Front    = [dir subj '_front_reduce_VRML1.wrl'];

 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
  'reduce_VRML'-File
        .LV   / .RV   / .FV   : 3D-Coordinate   : [Npoint 3]  [m]
        .LX   / .RX   / .FX   : 2D X-Coordinate : [Npoint 1]  [pixcel]
        .LY   / .RY   / .FY   : 2D Y-Coordinate : [Npoint 1]  [pixcel]
        .LF   / .RF   / .FF   : Patch index     : [Npatch Nnode]
        .Limg / .Rimg / .Fimg : 2D RGB image    : [NX NY 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(fname,mode)
0002 % Read VIVID VRML-Image
0003 % --- Input
0004 % fname.Left     = [dir subj '_left_reduce_VRML1.wrl' ];
0005 % fname.Right    = [dir subj '_right_reduce_VRML1.wrl'];
0006 % fname.Front    = [dir subj '_front_reduce_VRML1.wrl'];
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 %  'reduce_VRML'-File
0021 %        .LV   / .RV   / .FV   : 3D-Coordinate   : [Npoint 3]  [m]
0022 %        .LX   / .RX   / .FX   : 2D X-Coordinate : [Npoint 1]  [pixcel]
0023 %        .LY   / .RY   / .FY   : 2D Y-Coordinate : [Npoint 1]  [pixcel]
0024 %        .LF   / .RF   / .FF   : Patch index     : [Npatch Nnode]
0025 %        .Limg / .Rimg / .Fimg : 2D RGB image    : [NX NY 3]
0026 %
0027 % Copyright (C) 2011, ATR All Rights Reserved.
0028 % License : New BSD License(see VBMEG_LICENSE.txt)
0029 
0030 % 2006/2/2  M. Sato
0031 
0032 if ~exist('mode','var'), mode = 1; end;
0033 
0034 Coord = struct;
0035 
0036 if isfield(fname ,'Left')
0037     [V, F, img, X, Y] = vb_read_vivid_file(fname.Left);
0038     
0039     % Change Vivid Right-hand (mm) coord. to Right-hand SPM (m) coord.
0040     V  = vb_vivid_mm_to_spm_right(V,mode);
0041     
0042     Coord.LV   = V  ;
0043     Coord.LF   = F  ;
0044     Coord.LX   = X  ;
0045     Coord.LY   = Y  ;
0046     Coord.Limg = img;
0047     
0048     NPL = size(V,1);
0049     NXL = size(X,1);
0050     
0051     fprintf('Number of points in vivid 3D-Left-image= %d\n',NPL)
0052     fprintf('Number of points in vivid 2D-Left-image= %d\n',NXL)
0053     if NPL ~= NXL, disp('# of points in 2D & 3D does not match'); end;
0054 end
0055 
0056 if isfield(fname ,'Right')
0057     [V, F, img, X, Y] = vb_read_vivid_file(fname.Right);
0058     
0059     % Change Vivid Right-hand (mm) coord. to Right-hand SPM (m) coord.
0060     V  = vb_vivid_mm_to_spm_right(V,mode);
0061     
0062     Coord.RV   = V  ;
0063     Coord.RF   = F  ;
0064     Coord.RX   = X  ;
0065     Coord.RY   = Y  ;
0066     Coord.Rimg = img;
0067     
0068     NPR = size(V,1);
0069     NXR = size(X,1);
0070     
0071     fprintf('Number of points in vivid 3D-Right-image= %d\n',NPR)
0072     fprintf('Number of points in vivid 2D-Right-image= %d\n',NXR)
0073     if NPR ~= NXR, disp('# of points in 2D & 3D does not match'); end;
0074 end
0075     
0076 if isfield(fname ,'Front')
0077     [V, F, img, X, Y] = vb_read_vivid_file(fname.Front);
0078     
0079     % Change Vivid Right-hand (mm) coord. to Right-hand SPM (m) coord.
0080     V  = vb_vivid_mm_to_spm_right(V,mode);
0081     
0082     Coord.FV   = V  ;
0083     Coord.FF   = F  ;
0084     Coord.FX   = X  ;
0085     Coord.FY   = Y  ;
0086     Coord.Fimg = img;
0087     
0088     NPF = size(V,1);
0089     NXF = size(X,1);
0090     
0091     fprintf('Number of points in vivid 3D-Front-image= %d\n',NPF)
0092     fprintf('Number of points in vivid 2D-Front-image= %d\n',NXF)
0093     if NPF ~= NXF, disp('# of points in 2D & 3D does not match'); end;
0094 end

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