<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 Abdul,
<div class=""><br class="">
</div>
<div class="">What do you mean with ‘ctf is the coordinate system of the sensors’?</div>
<div class=""><br class="">
</div>
<div class="">For EEG data the ‘ctf’ convention is not a given, because it depends on how the electrodes have been digitized. I would first check the coordinate system’s definition for the EEG electrodes.</div>
<div class=""><br class="">
</div>
<div class="">Good luck,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div>
<blockquote type="cite" class="">
<div class="">On 1 Jun 2024, at 13:23, Anwar, Abdul Rauf via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="WordSection1" style="page: WordSection1; 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;">
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Hi<span class="Apple-converted-space"> </span><br class="">
I am trying to create a headmodel using template MRI and eeg recordings. Given is the piece of code that I have used. Issue is that in the final plot the headmodel and the sensor positions are not properly aligned. Can someone please tell me what part I am
 missing here ?  ‘ctf’ is the coordinate system of the sensors.<br class="">
Thanks<o:p class=""></o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">ft_defaults<o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">mri = ft_read_mri(<span style="color: rgb(167, 9, 245);" class="">'C:\ToolBoxes\fieldtrip-20240110\template\anatomy\single_subj_T1.nii'</span>);<o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">[mri_new] = ft_convert_coordsys(mri,<span class="Apple-converted-space"> </span><span style="color: rgb(167, 9, 245);" class="">'ctf'</span>);<o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">cfg           = [];<o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">cfg.output    =<span class="Apple-converted-space"> </span><span style="color: rgb(167, 9, 245);" class="">'brain'</span>;<o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">segmentedmri  = ft_volumesegment(cfg, mri_new);<o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">cfg = [];<o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">cfg.method=<span style="color: rgb(167, 9, 245);" class="">'singleshell'</span>;<o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">headmodel = ft_prepare_headmodel(cfg, segmentedmri);<o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">headmodel = ft_convert_units(headmodel,<span class="Apple-converted-space"> </span><span style="color: rgb(167, 9, 245);" class="">'cm'</span>);<o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">sens = ft_read_sens(<span style="color: rgb(167, 9, 245);" class="">'D:\Data_USB_13052024\Preprocessed_72230\Cleanline_0.1HP_Referenced_PrunedICA_Epoched.set'</span>,<span class="Apple-converted-space"> </span><span style="color: rgb(167, 9, 245);" class="">'senstype'</span>,<span class="Apple-converted-space"> </span><span style="color: rgb(167, 9, 245);" class="">'eeg'</span>);<o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">sens = ft_convert_units(sens,<span class="Apple-converted-space"> </span><span style="color: rgb(167, 9, 245);" class="">'cm'</span>);<o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">figure<o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">ft_plot_sens(sens,<span class="Apple-converted-space"> </span><span style="color: rgb(167, 9, 245);" class="">'style'</span>,<span class="Apple-converted-space"> </span><span style="color: rgb(167, 9, 245);" class="">'*b'</span>);<o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">hold<span class="Apple-converted-space"> </span><span style="color: rgb(167, 9, 245);" class="">on</span><o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10pt; font-family: Consolas;" class="">ft_plot_headmodel(headmodel);<o:p class=""></o:p></span></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
</div>
<span 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; float: none; display: inline !important;" class="">_______________________________________________</span><br 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="">
<span 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; float: none; display: inline !important;" class="">fieldtrip
 mailing list</span><br 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="">
<a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Cc2871e640c124d11f61508dc8532931d%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638531699460249320%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=RjqEo4reGzSy4KKlfANuO4mehR9613gu7cvCOI4e9X0%3D&reserved=0" originalsrc="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" shash="HOhCk9NCh4bVciXC7YwfVl0DF0bAh+dFUbOIHOEe8VJZqx18xOR8Qyo2UQs8k6aBHIjZn2xZGmIaIDuw6azGTQoVfa0RhAsALcAfG9aKfaz4md1XnoeAuyMPtPwLTbDzDKImTGHxiP+xi4Hzz3oGbQjZcytOVcl+CuVTasZMhfA=" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br 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="">
<a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Cc2871e640c124d11f61508dc8532931d%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638531699460249320%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=ey%2BSkZY5%2BbjiMRfLo2FX8LW%2B6L48EfFoHc9C2b%2B2SsA%3D&reserved=0" originalsrc="https://doi.org/10.1371/journal.pcbi.1002202" shash="rL2WV7UmkiYR5jq2mer9Edqy9FGXlAkEzDLBAq6V75Ix/3ZTGlzV2saiyvs3XkbMwUpzUWjNlHw21kRHl5wwFcFQ/UlMKuEJ7sUalHER5QueEnbP9F2XXTs+YYlKyU1eHlaNb0g9ZWNED9lfT2r+ZBfzbQdhHQA3zuHN47l7Plk=" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://doi.org/10.1371/journal.pcbi.1002202</a></div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>