Read Analyze/Nifti format header [dim,vox,origin] = analyze_hdr_read(imagefile) imagefile - filename --- Output DIM(1:3) - image size VOX(1:3) - voxel size [mm] ORIGIN(1:3) - origin [voxel index] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [dim,vox,origin] = analyze_hdr_read(imagefile) 0002 % Read Analyze/Nifti format header 0003 % [dim,vox,origin] = analyze_hdr_read(imagefile) 0004 % 0005 % imagefile - filename 0006 % 0007 % --- Output 0008 % DIM(1:3) - image size 0009 % VOX(1:3) - voxel size [mm] 0010 % ORIGIN(1:3) - origin [voxel index] 0011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0012 % 0013 % Copyright (C) 2011, ATR All Rights Reserved. 0014 % License : New BSD License(see VBMEG_LICENSE.txt) 0015 0016 [hdr, filetype] = load_nii_hdr_cbi(imagefile); 0017 0018 dim = hdr.dime.dim(2:4); 0019 vox = hdr.dime.pixdim(2:4); 0020 0021 dim = dim(:)'; 0022 vox = vox(:)'; 0023 0024 if nargout==2, return; end; 0025 0026 if filetype == 0 0027 origin = hdr.hist.originator(1:3); 0028 else 0029 nii.hdr = hdr; 0030 nii.filetype = filetype; 0031 0032 [orient, R, T] = get_orient_info(nii); 0033 0034 origin = - T; 0035 0036 origin = origin(:)'; 0037 end 0038 0039 return