<div dir="ltr"><div>Hi Arnaud and Sami, </div><div><br></div><div>I cannot speak to your second question, but re. the first one, from the top of my head (I can look up some of my code later if needed):</div><div>In my experience (after fiddling with this for more than 5 years now...), what has been working relatively well for us is to use ft_volumesegment on your MRI, then read the binary lesion mask (and realign it to the MRI if you did some realignment there) and then manually add it to your segmentation, subtracting it from the rest of the segmentation (so for ex. if SPM segments certain voxels as GM and you add those manually as lesion, you need to set those voxels to 0, depending on what type of segmentation you're using, indexed or probabilistic). Also,  if you're going to assign CSF conductivity for your lesion, then you could consider not adding it as a separate tissue, but rather add it into your CSF segmentation instead. The rest of the pipeline would remain the same, the head model will be prepared using this segmentation. </div><div><br></div><div>I hope this helps, </div><div>Vitoria</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, 18 Jun 2025 at 13:40, Sami LAMECHE via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear FieldTrip team,<br>
<br>
I am currently working on source reconstruction from EEG data in a patient who has suffered a stroke. I am using FieldTrip on Ubuntu 22.04 with MATLAB R2022a, and I would like to ask for advice on two specific issues:<br>
<br>
1.Stroke lesion segmentation  <br>
   I have an MRI volume of the patient, as well as a binary lesion mask (in NIfTI format) corresponding to the stroke area. I would like to include this lesion as a separate tissue class in the segmentation process (e.g., alongside gray matter, white matter, CSF, skull, and scalp) to generate a realistic headmodel.  <br>
   - Is there an official or recommended workflow in FieldTrip to incorporate a lesion mask into `ft_volumesegment` or another segmentation pipeline?<br>
   - If not, what is the best way to manually integrate this lesion into the segmentation structure in a way that remains compatible with headmodel creation?<br>
<br>
2. SimBio MEX compilation issues on Ubuntu 22.04<br>
   I am following the FEM pipeline described on the official FieldTrip tutorial ([<a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.fieldtriptoolbox.org%2Ftutorial%2Fsource%2Fheadmodel_eeg_fem%2F&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C221aa00d3ce64aaaf26708ddae62594b%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638858459615921982%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=ZfhB%2B1%2B5Y%2FW8A%2FsAN4FZHDQZFlR4dl%2Fb73EjBPQDacs%3D&reserved=0" originalSrc="https://www.fieldtriptoolbox.org/tutorial/source/headmodel_eeg_fem/" rel="noreferrer" target="_blank">https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.fieldtriptoolbox.org%2Ftutorial%2Fsource%2Fheadmodel_eeg_fem%2F&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Cf21c98cd657b4d8dd68808ddae574775%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638858412075229148%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=JN5z7IVG4ZqJMTA%2BFbjdTIWrJgS2GzRj%2B793Y5AEFRk%3D&reserved=0](https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.fieldtriptoolbox.org%2Ftutorial%2Fsource%2Fheadmodel_eeg_fem%2F&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Cf21c98cd657b4d8dd68808ddae574775%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638858412075256563%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=V5vL7mwmlgOpZ2LKXM0ctD17LEs0Sw5UOh3QFmXYT9o%3D&reserved=0)</a>). However, I encounter issues when trying to load the SimBio MEX files (when doing ft_prepare_headmodel) on Ubuntu 22.04 with MATLAB R2022a.  <br>
   Specifically, I receive the following error:<br>
<br>
Invalid MEX-file '.../calc_stiff_matrix_val.mexa64':<br>
... wrong ELF class, or undefined symbol, or GLIBC_x.x not found ...<br>
<br>
- Are there known compatibility issues with SimBio and Ubuntu 22.04 or with MATLAB R2022a?<br>
- Would you recommend specific compiler flags, patches, or an alternative build process to successfully compile and use SimBio’s MEX files in this setup?<br>
<br>
Any suggestions, workarounds, or reference materials would be very helpful.<br>
<br>
Best regards,  <br>
Arnaud Preuilh & Sami Lameche  <br>
LIB<br>
<br>
_______________________________________________<br>
fieldtrip mailing list<br>
<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%7C221aa00d3ce64aaaf26708ddae62594b%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638858459615938667%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=UhRsfqmWsRNYhTHBM3wr6r%2Bbu7v44a1F%2BtNZwQ6K%2Bow%3D&reserved=0" originalSrc="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<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%7C221aa00d3ce64aaaf26708ddae62594b%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638858459615955205%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=FkoZlP2YE6MAPHjg2PUEBtLceDW6FBmj%2FAODh7ESmc4%3D&reserved=0" originalSrc="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</blockquote></div>