load analyze/nifti image without L-R flip [B, Vdim, Vsize] = vb_load_analyze_noflip(analyzefile) --- Input analyzefile - 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) written by M. Sato 2008-2-26 Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [B, Vdim, Vsize] = vb_load_analyze_noflip(analyzefile) 0002 % load analyze/nifti image without L-R flip 0003 % [B, Vdim, Vsize] = vb_load_analyze_noflip(analyzefile) 0004 % --- Input 0005 % analyzefile - 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 % 0013 % written by M. Sato 2008-2-26 0014 % 0015 % Copyright (C) 2011, ATR All Rights Reserved. 0016 % License : New BSD License(see VBMEG_LICENSE.txt) 0017 0018 % load analyze/nifti image file without flip orientation 0019 avw = load_nii_cbi(analyzefile); 0020 0021 B = avw.img; 0022 0023 Vdim = size(B); 0024 Vsize = avw.hdr.dime.pixdim(2:4); 0025 0026 %try 0027 % % Faster than avw_img_read, but sometimes make error 0028 % [B, Vdim, Vsize] = read_image(analyzefile); 0029 % B = reshape(B,Vdim); 0030 %catch 0031 % warning(['The "read_image" function output an error. '... 0032 % 'Try "avw_img_read" function']); 0033 % avw = avw_img_read(analyzefile); 0034 % B = avw.img; 0035 % [Vdim, Vsize] = spm_hread(analyzefile); 0036 %end 0037 % 0038 %return 0039 % 0040 %%&& DEBUG 0041 %B1 = B1(Vdim(1):-1:1, :,:); 0042 %errB = vb_err_array3d(B,B1) 0043 %errD = Vdim - Vdim1 0044 %errS = Vsize - Vsize1 0045 %%&& DEBUG