<div dir="ltr"><div>Dear fieldtrip experts,</div><div><br></div><div>I would need to create a volume conduction model of the head using standard_mri.m. standard_mri.m is in the spm coordinate system and my MEG data in the neuromag system. To get all data in the same coordinate system, I have converted standard_mri.m to neuromag using ft_volumerealign. However, ft_volumesegment converts MRI back to spm. </div><div><br></div><div>Could someone please let me know how I can get the head model and MEG data in the same coordinate system? </div><div>I really appreciate any help you can provide!</div><div><br></div><div>Here is what I have tried:</div><div><br></div><div>mri is in spm coordinate system:</div><div><br></div><div>mri = </div><div><br></div><div>          dim: [181 217 181]</div><div>      anatomy: [181x217x181 uint8]</div><div>    transform: [4x4 double]</div><div>          hdr: [1x1 struct]</div><div>         unit: 'mm'</div><div>     coordsys: 'spm'</div><div><br></div><div>Check fiducials for ft_volumerealign:</div><div><br></div><div>hs=ft_read_headshape('aml_sentences16b_raw_tsss.fif', 'unit','mm');</div><div><br></div><div>hs.fid.pos</div><div><br></div><div>ans =</div><div><br></div><div>  -66.1226    0.0000   -0.0000</div><div>   -0.0000   83.5082   -0.0000</div><div>   67.1784   -0.0000   -0.0000</div><div><br></div><div>hs.fid.label</div><div><br></div><div>ans = </div><div><br></div><div>    'LPA'</div><div>    'Nasion'</div><div>    'RPA'</div><div><br></div><div>cfg = [];</div><div>cfg.method= 'fiducial';</div><div>cfg.fiducial.nas    = [-0.0000 83.5082 -0.0000]; </div><div>cfg.fiducial.lpa    = [-66.1226 0.0000 -0.0000];</div><div>cfg.fiducial.rpa    = [67.1784 -0.0000 -0.0000];</div><div>cfg.coordsys= 'neuromag';</div><div>cfg.headshape = hs;</div><div>mri_realigned = ft_volumerealign(cfg, mri);</div><div><br></div><div>mri_realigned seems to be in neuromag system as it should be.</div><div><br></div><div>mri_realigned = </div><div><br></div><div>              dim: [181 217 181]</div><div>          anatomy: [181x217x181 uint8]</div><div>        transform: [4x4 double]</div><div>              hdr: [1x1 struct]</div><div>             unit: 'mm'</div><div>         coordsys: 'neuromag'</div><div>           inside: [181x217x181 logical]</div><div>    transformorig: [4x4 double]</div><div>              cfg: [1x1 struct]</div><div><br></div><div>However, ft_volumesegment converts it back to spm system:</div><div>cfg           = [];</div><div>cfg.output    = 'brain';</div><div>cfg.coordsys  = 'neuromag'; </div><div>segmentedmri  = ft_volumesegment(cfg, mri_realigned);</div><div><br></div><div>Warning: The option cfg.coordsys is deprecated, support is no longer guaranteed</div><div> </div><div>> In ft_checkconfig (line 168)</div><div>  In ft_volumesegment (line 170) </div><div>the input is volume data with dimensions [181 217 181]</div><div>Converting the coordinate system from neuromag to spm</div><div><br></div><div><br></div><div>I also tried to convert MEG data to spm system as follows:</div><div><br></div><div>hdr = ft_read_header('aml_sentences16b_raw_tsss.fif', 'unit','mm');</div><div><br></div><div>cfg = [];</div><div>cfg.method= 'fiducial';</div><div>cfg.target.pos(1,:)    = [1 0 0];</div><div>cfg.target.pos(1,:)    = [0 83 0];</div><div>cfg.target.pos(1,:)    = [0 -117 0];</div><div>cfg.target.lab    = {'NAS', 'LPA', 'RPA'};</div><div>cfg.grad = hdr.grad;</div><div>mri_realigned = ft_sensorrealign(cfg);</div><div><br></div><div>… but got:</div><div><br></div><div>Warning: FT_SENSORREALIGN is deprecated, please use FT_ELECTRODEREALIGN instead. </div><div>> In ft_sensorrealign (line 118) </div><div>using gradiometers specified in the configuration</div><div>Reference to non-existent field 'label'.</div><div><br></div><div>Error in ft_datatype_sens (line 148)</div><div>nchan = length(sens.label);</div><div><br></div><div>Error in ft_sensorrealign (line 247)</div><div>    tmp(i) = ft_datatype_sens(template(i));            % ensure up-to-date sensor description</div><div><br></div><div>template(i) seems to be as follows:</div><div><br></div><div>ans = </div><div><br></div><div>    pos: [0 -117 0]</div><div>    lab: {'NAS'  'LPA'  'RPA'}</div><div><br></div><div>I think that ft_electroderealign only works with EEG data since it gives: </div><div><br></div><div>mri_realigned = ft_electroderealign(cfg);</div><div>Warning: The field cfg.headshape is forbidden, it will be removed from your configuration</div><div> </div><div>> In ft_checkconfig (line 215)</div><div>  In ft_electroderealign (line 212) </div><div>using gradiometers specified in the configuration</div><div>Reference to non-existent field 'elecpos'.</div><div><br></div><div>Error in ft_electroderealign (line 254)</div><div>assert(isequaln(elec_original.elecpos, elec_original.chanpos), 'this function requires same electrode and channel</div><div>positions.');</div><div><br></div><div>Best,</div><div>Maria</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>