0001 function [Coord] = vb_read_vivid(fname,mode)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
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
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
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
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