Home > vbmeg > functions > tool_box > neuromag > neuro_head_to_spm_transmat.m

neuro_head_to_spm_transmat

PURPOSE ^

Transform matrix from Neuromag-Head coordinate to SPM coordinate

SYNOPSIS ^

function trans_info = neuro_head_to_spm_transmat(trans_info,Vdim,Vsize)

DESCRIPTION ^

 Transform matrix from Neuromag-Head coordinate to SPM coordinate
  trans_mat = neuro_head_to_spm_transmat(trans_info,Vdim,Vsize)
 ---- Input
 trans_info.trans_head2vox : transform matrix (HEAD ==> Voxel)
                           :  [4 x 4 double]
 Vdim  : Voxel dimension of Analize image
 Vsize : Voxel size of Analize image
 ---- Output
 trans_info.head2vox : transform matrix ( HEAD  ==> Voxel)
 trans_info.vox2spm  : transform matrix (Voxcel ==> SPM)
 trans_info.head2spm : transform matrix ( HEAD  ==> SPM)

 --- MRI-Voxel coordinate  (Image based)

 [Left-hand coordinate]
 X:Right(1) -> Left(256)   R->L
 Y:Front(1) -> Back(256)   A->P
 Z:Top(1)   -> Bottom(136) S->I

 --- SPM coordinate (Image based)

 [Right-hand coordinate]
 X: Left(-191/2)   -> Right(191/2) 
 Y: Back(-256/2)   -> Front(256/2)
 Z: Bottom(-256/2) -> Top(256/2) 

 --- Head coordinate
 X : from left to right : LPA -> RPA
 Y : from back to front : Nasion -> x-axis
 Z : from bottom to up.

 Vspm(:,1) =  ( - Vox(:,1) + Vdim(1)*0.5 )*Vsize(1);
 Vspm(:,2) =  ( - Vox(:,2) + Vdim(2)*0.5 )*Vsize(2);
 Vspm(:,3) =  ( - Vox(:,3) + Vdim(3)*0.5 )*Vsize(3);
 Vspm = Vspm*0.001; Change [mm] to [m]

 Masa-aki Sato 2009-4-13

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    trans_info = neuro_head_to_spm_transmat(trans_info,Vdim,Vsize)
0002 % Transform matrix from Neuromag-Head coordinate to SPM coordinate
0003 %  trans_mat = neuro_head_to_spm_transmat(trans_info,Vdim,Vsize)
0004 % ---- Input
0005 % trans_info.trans_head2vox : transform matrix (HEAD ==> Voxel)
0006 %                           :  [4 x 4 double]
0007 % Vdim  : Voxel dimension of Analize image
0008 % Vsize : Voxel size of Analize image
0009 % ---- Output
0010 % trans_info.head2vox : transform matrix ( HEAD  ==> Voxel)
0011 % trans_info.vox2spm  : transform matrix (Voxcel ==> SPM)
0012 % trans_info.head2spm : transform matrix ( HEAD  ==> SPM)
0013 %
0014 % --- MRI-Voxel coordinate  (Image based)
0015 %
0016 % [Left-hand coordinate]
0017 % X:Right(1) -> Left(256)   R->L
0018 % Y:Front(1) -> Back(256)   A->P
0019 % Z:Top(1)   -> Bottom(136) S->I
0020 %
0021 % --- SPM coordinate (Image based)
0022 %
0023 % [Right-hand coordinate]
0024 % X: Left(-191/2)   -> Right(191/2)
0025 % Y: Back(-256/2)   -> Front(256/2)
0026 % Z: Bottom(-256/2) -> Top(256/2)
0027 %
0028 % --- Head coordinate
0029 % X : from left to right : LPA -> RPA
0030 % Y : from back to front : Nasion -> x-axis
0031 % Z : from bottom to up.
0032 %
0033 % Vspm(:,1) =  ( - Vox(:,1) + Vdim(1)*0.5 )*Vsize(1);
0034 % Vspm(:,2) =  ( - Vox(:,2) + Vdim(2)*0.5 )*Vsize(2);
0035 % Vspm(:,3) =  ( - Vox(:,3) + Vdim(3)*0.5 )*Vsize(3);
0036 % Vspm = Vspm*0.001; Change [mm] to [m]
0037 %
0038 % Masa-aki Sato 2009-4-13
0039 %
0040 % Copyright (C) 2011, ATR All Rights Reserved.
0041 % License : New BSD License(see VBMEG_LICENSE.txt)
0042 
0043 if nargin < 3, error('Input argument error'); end
0044 
0045 % Head -> Voxcel
0046 head2vox = trans_info.trans_head2vox;
0047 
0048 % Voxcel -> SPM
0049 vox2spm = - diag(0.001*Vsize);
0050 xtrans  = 0.5 * 0.001 * Vdim(:) .* Vsize(:);
0051 vox2spm = [vox2spm ,xtrans ; zeros(1,3) 1]';
0052 
0053 trans_info.vox2spm  = vox2spm;
0054 
0055 % Head -> SPM
0056 trans_info.head2spm = head2vox * vox2spm;
0057 trans_info.head2vox = head2vox;

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005