Load Analyze/Nifti file to RAS image [B, Vdim, Vsize] = vb_load_analyze_to_right(fname) --- Input fname - Analyze/Nifti filename Default Analyze file is left-handed LAS image Default Nifti file is Right-handed RAS image --- Output B : 3D image data [Xdim, Ydim, Zdim ] Vdim : image size [Xdim Ydim Zdim ] (voxels) Vsize : voxel size [x y z ] (mm) Trans : transform matrix from voxcel to Right-hand mm coordinate [x y z 1] = [i j k 1] * Trans written by M. Sato 2008-2-18 Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [B, Vdim, Vsize, Trans] = vb_load_analyze_to_right(fname) 0002 % Load Analyze/Nifti file to RAS image 0003 % [B, Vdim, Vsize] = vb_load_analyze_to_right(fname) 0004 % --- Input 0005 % fname - Analyze/Nifti filename 0006 % Default Analyze file is left-handed LAS image 0007 % Default Nifti file is Right-handed RAS image 0008 % --- Output 0009 % B : 3D image data [Xdim, Ydim, Zdim ] 0010 % Vdim : image size [Xdim Ydim Zdim ] (voxels) 0011 % Vsize : voxel size [x y z ] (mm) 0012 % Trans : transform matrix from voxcel to Right-hand mm coordinate 0013 % [x y z 1] = [i j k 1] * Trans 0014 % 0015 % 0016 % written by M. Sato 2008-2-18 0017 % 0018 % Copyright (C) 2011, ATR All Rights Reserved. 0019 % License : New BSD License(see VBMEG_LICENSE.txt) 0020 0021 % load analyze/nifti image file to RAS orientation 0022 avw = load_nii_ras(fname); 0023 0024 B = avw.img; 0025 0026 Vdim = size(B); 0027 Vsize = avw.hdr.dime.pixdim(2:4); 0028 0029 if nargout<4, return; end; 0030 0031 [orient, R, T] = get_orient_info(avw); 0032 Trans = [R' zeros(3,1); T' 1]; 0033 % [x ; y ; z] = R * [i ; j ; k] + T 0034 % [x y z 1] = [i j k 1] * Trans 0035 0036 return 0037