<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi All,
<div><br>
</div>
<div>I am having a great deal of difficulty accurately fitting dipoles. 'Dipoles' are ending up being shown outside the head......</div>
<div>This may be to do with problems in aligning the anatomical data with the sensors. I have used <span style="font-family: Courier; font-size: 10px;">ft_volumerealign </span><span style="font-size: 10pt;">to fit the MRI to the neuromag coordinate system,
 so I am not sure where the problem is arising from.</span></div>
<div><span style="font-size: 10pt;"><br>
</span></div>
<div>Any help or suggestions, especially from Neuromag users, much appreciated!</div>
<div><br>
</div>
<div>Here is my code:</div>
<div><br>
</div>
<div>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; color: rgb(178, 69, 243);">
<span style="color: #000000">mri = ft_read_mri(</span>'MRI.nii'<span style="color: #000000">);</span></p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; color: rgb(178, 69, 243);">
<span style="color: #000000"><br>
</span></p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);">
%%</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); min-height: 12px;">
 </p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
cfg=[];</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
cfg.method = <span style="color: #b245f3">'interactive'</span>;</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
cfg.coordsys = <span style="color: #b245f3">'neuromag'</span>;</p>
<p style="margin-right: 0px; margin-left: 0px;"><font face="Courier" size="1">mri_real = ft_volumerealign(cfg, mri); </font><span style="font-family: Courier; font-size: 10px; color: rgb(37, 153, 45);">% Marked left and right </span><font color="#25992d" face="Courier" size="1">fiducials
 along with naison</font></p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
<br>
</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);">
%%</p>
</div>
<div>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);">
<span style="color: rgb(0, 0, 0);"><br>
</span></p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);">
<span style="color: rgb(0, 0, 0);">cfg </span><span style="color: rgb(0, 0, 0);">         
</span><span style="color: rgb(0, 0, 0);">= [];</span></p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
cfg.coordsys=<span style="color: #b245f3">'neuromag'</span>;</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
cfg.output    = {<span style="color: #b245f3">'skullstrip'</span> <span style="color: #b245f3">
'brain'</span>};</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
seg           = ft_volumesegment(cfg, mri_real); </p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
<br>
</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);">
%% </p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
cfg = [];</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
cfg.coordsys=<span style="color: #b245f3">'neuromag'</span>;</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
cfg.method = <span style="color: #b245f3">'singleshell'</span>;</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
vol = ft_prepare_headmodel(cfg, seg); <span style="color: rgb(37, 153, 45);">%Volume conduction model</span></p>
</div>
<div><br>
</div>
<div>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);">
%% Plotting volume conduction model along with sensor positions.</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);">
% When these are plotted, the volume conduction model does appear to be positioned too high in the sensors- see jpg</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);">
<br>
</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
vol = ft_convert_units(vol,<span style="color: #b245f3">'cm'</span>);</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);">
<span style="color: #000000">sens = grad;</span>% 'grad' contains neuromag sensor info- taken from MEG data</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); min-height: 12px;">
<span style="color: rgb(0, 0, 0);">figure</span></p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
ft_plot_sens(sens, <span style="color: #b245f3">'style'</span>, <span style="color: #b245f3">
'*b'</span>);</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; min-height: 12px;">
hold <span style="color: rgb(178, 69, 243);">on</span></p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
ft_plot_vol(vol);</p>
</div>
<div><br>
</div>
<div>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);">
%% Fitting dipoles</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); min-height: 12px;">
 </p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
cfg=[];</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
cfg.numdipoles =1;</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
cfg.latency = [0.05, 0.10];</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);">
<span style="color: #000000">cfg.vol = vol; </span>%volume conduction model for the subject</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
cfg.model = <span style="color: #b245f3">'regional'</span>;</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
cfg.grad=grad;<span style="color: rgb(37, 153, 45);">% 'grad' contains neuromag sensor info- taken from MEG data</span></p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
source = ft_dipolefitting(cfg, timelocked_data);</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 12px; font-family: Courier; min-height: 14px;">
<br>
</p>
</div>
<div>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45);">
%% make a plot of the location of the dipoles</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
cfg = [];</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
cfg.location = source.dip.pos* 10;   <span style="color: #25992d">% convert from cm to mm</span></p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
figure; ft_sourceplot(cfg, mri_real);</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
<br>
</p>
<p style="margin-right: 0px; margin-left: 0px; font-size: 10px; font-family: Courier;">
<br>
</p>
</div>
<div>Once again, any help or suggestions, especially from Neuromag users, much appreciated!</div>
<div><br>
</div>
<div>Kaelasha Tyler</div>
</div>
</body>
</html>