usage: [trans_head2mri] = fiff_read_coord_trans(transfile) input: transfile = name of transformation fif file (usually stored in the subject's Freesurfer directory in /mri/T1-neuromag/sets). output: trans_head2mri = transformation structure from head to MRI coordinate systems. Note: the inverse transformation, from MRI to head coordinate systems can be obtained by just taking the inverse: trans_mri2head.from=5; trans_mri2head.to=4; trans_mri2head.trans=inv(trans_head2mri.trans); author: Rey Ramirez email: rrramir@uw.edu
0001 function [trans_head2mri] = fiff_read_coord_trans(transfile) 0002 % 0003 % usage: [trans_head2mri] = fiff_read_coord_trans(transfile) 0004 % 0005 % input: 0006 % transfile = name of transformation fif file (usually stored in 0007 % the subject's Freesurfer directory in /mri/T1-neuromag/sets). 0008 % 0009 % output: 0010 % trans_head2mri = transformation structure from head to MRI coordinate systems. 0011 % 0012 % Note: the inverse transformation, from MRI to head coordinate systems 0013 % can be obtained by just taking the inverse: 0014 % trans_mri2head.from=5; trans_mri2head.to=4; 0015 % trans_mri2head.trans=inv(trans_head2mri.trans); 0016 % 0017 % author: Rey Ramirez email: rrramir@uw.edu 0018 0019 FIFF = fiff_define_constants; 0020 [fid,~,dir] = fiff_open(transfile); 0021 a = find([dir.kind] == FIFF.FIFF_COORD_TRANS); 0022 pos = dir(a(1)).pos; 0023 tag = fiff_read_tag(fid,pos); 0024 trans_head2mri = tag.data;