<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Elisa,
<div class=""><br class="">
</div>
<div class="">Can you point us to the ‘rotation problem’ in the figure you attached? I don’t see it. Both figures have the electrodes placed in the same orientation (in the figure), relative to the ‘head’. Given that the distribution left/right is more or less
 symmetric, it seems to me that everything went according to plan. The onlly difference I see is how the positions are scaled with respect to the size of the circle. So, I don’t understand what you think is wrong. Also, you did not provide us with any additional
 details with respect to the cfg used to call ft_prepare_layout, nor what type of data you are using etc. </div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 29 Mar 2023, at 17:10, Elisa Tatti <<a href="mailto:elisatatti@msn.com" class="">elisatatti@msn.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div id="divRplyFwdMsg" dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<div class=""><br class="Apple-interchange-newline">
 </div>
</div>
<div dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<div class="x_elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);">
Dear Fieldtrip community,<span class="Apple-converted-space"> </span><br class="">
</div>
<div class="x_elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);">
I am writing to ask for help with creating the channel layout using the function ft_prepare_layout. I have two questions:<br class="">
</div>
<div class="x_elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);">
<br class="">
</div>
<div class="x_elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);">
<ol class="">
<li class="x_elementToProof elementToProof"><span class="">In the past, I successfully used the option cfg.rotate to rotate the axis of 90 degrees due to the differences in orientation between eeglab and fieldtrip. In the latest Fieldtrip (20230118) version,
 the option cfg.rotate does not work anymore. It does not give any error and it creates the layout but it does not rotate the axis. I ran the function with cfg.rotate both as default [] (which should automatically rotate the axis) and with different rotations
 (90,180). I checked the output and it seems it is not rotating the axis at all.<span class="Apple-converted-space"> </span><br class="">
</span>
<div class="x_elementToProof elementToProof"><span class="ContentPasted1">I compared it with a previous version (20200607) (where it works perfectly) and noticed that parts of the code have been changed. Specifically, in ft_prepare_layout in Fieldtrip 20200607
 the section that rotates the axis using ft_warp_apply (lines 1291-1307, see below) in the subfunction sens2lay has been changed in Fieldtrip 20230118. I can see the function ft_warp_apply for the subfunction opto2lay but it is not there for sens2lay<span class="Apple-converted-space"> </span><span class="ContentPasted1 ContentPasted3">anymore</span>.
 I am unsure if that is actually what it was meant to be done and it is okay like this but may this be the reason why it does not rotate anymore?<br class="">
</span></div>
</li></ol>
<div class="elementToProof">Old Fieldtrip function:<span class="Apple-converted-space"> </span><br class="">
</div>
<div class="elementToProof"><br class="">
</div>
<div class="ContentPasted2 elementToProof"><span style="font-size: 9pt;" class="">% apply rotation, but only if viewpoint is not used specifically</span>
<div class="ContentPasted2"><span style="font-size: 9pt;" class="">if isempty(viewpoint)</span></div>
<div class="ContentPasted2"><span style="font-size: 9pt;" class="">  if isempty(rotatez)</span></div>
<div class="ContentPasted2"><span style="font-size: 9pt;" class="">    switch ft_senstype(sens)</span></div>
<div class="ContentPasted2"><span style="font-size: 9pt;" class="">      case {'ctf151', 'ctf275', 'bti148', 'bti248', 'ctf151_planar', 'ctf275_planar', 'bti148_planar', 'bti248_planar', 'yokogawa160', 'yokogawa160_planar', 'yokogawa64', 'yokogawa64_planar',
 'yokogawa440', 'yokogawa440_planar', 'magnetometer', 'meg'}</span></div>
<div class="ContentPasted2"><span style="font-size: 9pt;" class="">        rotatez = 90;</span></div>
<div class="ContentPasted2"><span style="font-size: 9pt;" class="">      case {'neuromag122', 'neuromag306'}</span></div>
<div class="ContentPasted2"><span style="font-size: 9pt;" class="">        rotatez = 0;</span></div>
<div class="ContentPasted2"><span style="font-size: 9pt;" class="">      case 'electrode'</span></div>
<div class="ContentPasted2"><span style="font-size: 9pt;" class="">        rotatez = 90;</span></div>
<div class="ContentPasted2"><span style="font-size: 9pt;" class="">      otherwise</span></div>
<div class="ContentPasted2"><span style="font-size: 9pt;" class="">        rotatez = 0;</span></div>
<div class="ContentPasted2"><span style="font-size: 9pt;" class="">    end</span></div>
<div class="ContentPasted2"><span style="font-size: 9pt;" class="">  end</span></div>
<div class="ContentPasted2"><span style="font-size: 9pt;" class="">  sens.chanpos = ft_warp_apply(rotate([0 0 rotatez]), sens.chanpos, 'homogenous');</span></div>
<span style="font-size: 9pt;" class="">end</span><br class="">
</div>
<div class="elementToProof"><br class="">
</div>
<div class="elementToProof">Fieldtrip 20230118</div>
<div class="elementToProof"><br class="">
</div>
<div class="ContentPasted4 elementToProof">
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">% apply rotation, but only if viewpoint is not used specifically</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">if isempty(viewpoint) && isempty(rotatez)</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">  if isfield(sens, 'coordsys')</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">    % the x-axis to the right of the screen and the y-axis is to the top of the screen</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">    % the nose is usually plotted toward the top of the screen</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">    sens = ft_convert_coordsys(sens, 'ras', 0);</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">  elseif isfield(sens, 'type') && startsWith(sens.type, 'ctf')</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">    sens.coordsys = 'ctf';</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">    sens = ft_convert_coordsys(sens, 'ras', 0);</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">  elseif isfield(sens, 'type') && startsWith(sens.type, 'bti')</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">    sens.coordsys = 'bti';</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">    sens = ft_convert_coordsys(sens, 'ras', 0);</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">  elseif isfield(sens, 'type') && startsWith(sens.type, '4d')</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">    sens.coordsys = '4d';</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">    sens = ft_convert_coordsys(sens, 'ras', 0);</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">  elseif isfield(sens, 'type') && startsWith(sens.type, 'yokogawa')</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">    sens.coordsys = 'yokogawa';</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">    sens = ft_convert_coordsys(sens, 'ras', 0);</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">  elseif isfield(sens, 'type') && startsWith(sens.type, 'neuromag')</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">    sens.coordsys = 'neuromag';</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">    sens = ft_convert_coordsys(sens, 'ras', 0);</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">  elseif isfield(sens, 'type') && startsWith(sens.type, 'itab')</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">    sens.coordsys = 'itab';</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">    sens = ft_convert_coordsys(sens, 'ras', 0);</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">  else</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">    ft_warning('use cfg.rotate to specify the correct rotation of the sensors');</span></div>
<div class="ContentPasted4"><span style="font-size: 9pt;" class="">  end</span></div>
<span style="font-size: 9pt;" class="">end</span><br class="">
</div>
<span class=""></span>
<div class="elementToProof"><span class=""><br class="">
</span></div>
<div class="elementToProof"><span class="">If anyone has information about it, please share it with the community. Thank you!</span></div>
<ol start="2" class="">
<li class="x_elementToProof elementToProof"><span class="x_ContentPasted2 x_ContentPasted0 ContentPasted0">Using the old Fieldtrip version, I created the layout using ft_prepare_layout and 90 degrees rotation to have the frontal channels oriented toward the
 nose. However, when I plot the channels with the function ft_plot_layout, they look too centered in the middle (see the attached image with a comparison between<span class="Apple-converted-space"> </span><span class="x_ContentPasted1 x_ContentPasted0">the
 EEGLAB</span><span class="Apple-converted-space"> </span>channel layout and the output of ft_prepare_layout. What can I do to fix them?</span></li></ol>
<div class="x_elementToProof">Thank you in advance for your help!</div>
<div class="x_elementToProof"><br class="">
</div>
<div class="x_elementToProof">Best.</div>
<div class="x_elementToProof"><br class="">
</div>
<div class="x_elementToProof">Elisa<br class="">
</div>
<div class="x_elementToProof"><br class="">
</div>
</div>
<div class="x_elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);">
<br class="">
</div>
<div class="x_elementToProof" style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);">
<br class="">
</div>
<div class="x_elementToProof">
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div id="x_Signature" class="">
<div class="">
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<div style="margin-top: 0px; margin-bottom: 0px; text-align: start; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">
<font size="2" face="Arial, Helvetica, sans-serif" class=""><span style="margin: 0px; color: rgb(102, 102, 102);" class="">Elisa Tatti, Ph.D.</span></font></div>
<div style="margin-top: 0px; margin-bottom: 0px; text-align: start; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">
<font size="2" face="Arial, Helvetica, sans-serif" class=""><br class="">
</font></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; margin: 0px; text-align: start; background-color: rgb(255, 255, 255);" class="">
<div style="margin: 0px;" class="">
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><font size="2" face="Arial, Helvetica, sans-serif" class=""><span style="margin: 0px; color: rgb(102, 102, 102);" class="">Research Associate</span></font></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><font size="2" face="Arial, Helvetica, sans-serif" class=""><span style="margin: 0px; color: rgb(102, 102, 102);" class="">Research Foundation of the City University of New York</span></font></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><font size="2" face="Arial, Helvetica, sans-serif" class=""><span style="margin: 0px; color: rgb(102, 102, 102);" class="">CUNY, School of Medicine </span></font></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><font size="2" face="Arial, Helvetica, sans-serif" class=""><span style="margin: 0px; color: rgb(102, 102, 102);" class="">160 Convent ave</span></font></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><font size="2" face="Arial, Helvetica, sans-serif" class=""><span style="margin: 0px; color: rgb(102, 102, 102);" class="">New York City, NY, 10031 </span></font><font size="2" face="Arial, Helvetica, sans-serif" class=""><span style="margin: 0px; color: rgb(102, 102, 102);" class=""><br class="">
</span></font></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><font size="2" face="Arial, Helvetica, sans-serif" class=""><span style="margin: 0px; color: rgb(102, 102, 102);" class=""><br class="">
</span></font></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><font size="2" face="Arial, Helvetica, sans-serif" class=""><span style="margin: 0px; color: rgb(102, 102, 102);" class="">Adjunct Assistant Professor </span></font></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><font size="2" face="Arial, Helvetica, sans-serif" class=""><span style="margin: 0px; color: rgb(102, 102, 102);" class="">College of Staten Island,</span></font></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><font size="2" face="Arial, Helvetica, sans-serif" class=""><span style="margin: 0px; color: rgb(102, 102, 102);" class="">2800 Victory Blvd, Staten Island, NY 10314 </span></font></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" class="">
<span style="margin: 0px; color: rgb(102, 102, 102); font-size: 11pt;" class="">Tel. +1 3472043952</span></div>
</div>
</div>
<br class="">
</div>
</div>
</div>
</div>
</div>
<span id="cid:702901C0-9CF8-403C-98EA-ED43381F74A3"><Screen Shot 2023-03-28 at 3.27.08 PM.png></span></div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>