change MNI-mm coordinate to analyze Right-hand voxcel coord. [XYZ] = vb_MNI_to_analyze(XYZmm,fname) --- Input XYZmm - mm-coordinates ( origin is defined by analyze file) fname - Standard brain image file --- Output XYZ - Analyze Right-hand voxcel-coordinates %% Template file is neurological format (right handed spm). MNI T1 template file (voxcel size = 2 x 2 x 2 mm ) \vbmeg\tool_box\atlas2vb\MNI_atlas_templates\MNI_T1.img Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [XYZ] = vb_MNI_to_analyze(XYZmm,fname) 0002 % change MNI-mm coordinate to analyze Right-hand voxcel coord. 0003 % [XYZ] = vb_MNI_to_analyze(XYZmm,fname) 0004 % --- Input 0005 % XYZmm - mm-coordinates ( origin is defined by analyze file) 0006 % fname - Standard brain image file 0007 % --- Output 0008 % XYZ - Analyze Right-hand voxcel-coordinates 0009 % 0010 %%% Template file is neurological format (right handed spm). 0011 % MNI T1 template file (voxcel size = 2 x 2 x 2 mm ) 0012 % \vbmeg\tool_box\atlas2vb\MNI_atlas_templates\MNI_T1.img 0013 % 0014 % 0015 % Copyright (C) 2011, ATR All Rights Reserved. 0016 % License : New BSD License(see VBMEG_LICENSE.txt) 0017 0018 % Read image-header 0019 [dim, vox, origin] = analyze_hdr_read(fname); 0020 % origin in voxcel-space -> origin in MNI-mm space 0021 origin = vox .* origin; 0022 0023 % XYZmm - mm-coordinates (origin is defined by 'origin') 0024 % XYZ - Analyze voxcel-coordinates 0025 % 0026 % XYZmm(i,:) = [vox(i)*XYZ(i,:) - origin(i)] 0027 % XYZ(i,:) = ( XYZmm(i,:) + origin(i) )/vox(i) 0028 0029 XYZ(1,:) = round(( XYZmm(1,:) + origin(1) )/vox(1)); 0030 XYZ(2,:) = round(( XYZmm(2,:) + origin(2) )/vox(2)); 0031 XYZ(3,:) = round(( XYZmm(3,:) + origin(3) )/vox(3)); 0032 0033