<div dir="auto"><div>Hi Sami,<div dir="auto"><br></div><div dir="auto">Yeah, the automatic segmentation of lesions is very tricky. We've had most success with combining toolboxes and manual adjustments.</div><div dir="auto">Two things: apparently there were lesion delineations available, which were used to mask your images. Can't you use those?</div><div dir="auto">I guess the zero intensity values are not unique to the masked areas? If there's a way to identify those (eg where zero values occur in voxels indexed as scalp or skull), then you only need to get those indices and assign them the tissue you want.</div><div dir="auto"><br></div><div dir="auto">Re. your other question: I'm not sure. By applying a larger mask, you also make the forward model less realistic - you would be increasing the amount of this tissue, with a conductivy value known to have the biggest impact. So you would still be impacting the estimates you get. Instead, I would model it as accurately as possible and stay away from interpreting too much what would be reconstructed close to the lesion. Maybe others would have a different take on this, I'm not sure.</div><div dir="auto"><br></div><div dir="auto">Good luck,</div><div dir="auto">Vitória </div><br><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Thu, 19 Jun 2025, 17:21 Sami LAMECHE, <<a href="mailto:sami.lameche@imt-atlantique.net">sami.lameche@imt-atlantique.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Vitoria and John,<br>
<br>
Thank you very much for your quick and detailed response, it is really appreciated and helpful.<br>
<br>
Regarding the segmentation: we actually already have an MRI image where the lesion area has been masked with zero intensity values. When running an indexed segmentation (`ft_volumesegment`) on this image, we observed that the lesion is most often misclassified as scalp or skull tissue (ref. to the joint images). <br>
<br>
As for the conductivity, we came across a recent publication (entitled "The impact of brain lesions on tDCS-induced electric fields" by Carys Evans et al. 2023) which reports that stroke lesion conductivity values are close to 1.2 S/m. Based on this, we would like to model the lesion as a separate tissue class with that specific conductivity value.<br>
<br>
We also read the article you co-authored (entitled "Estimating the influence of stroke lesions on MEG source reconstruction" by Maria Carla Piastra et al.2022), in which you mention that reconstructed sources located within approximately 20 mm around the lesion are less reliable. This raised an important question for us: do you think it would be more appropriate to apply a slightly larger mask to account for this zone of uncertainty during source modeling?<br>
<br>
Thank you John for your suggestion; we'll test 'DUNeuro' that compiles an FEM too. It is under study right now.<br>
<br>
Thanks again for your time and insight, we’re grateful for your expertise.<br>
<br>
Best regards,  <br>
Arnaud Preuilh & Sami Lameche<br>
LIB <br>
<br>
<br>
----- Mail original -----<br>
De: "Vitoria Piai" <<a href="mailto:v.piai.research@gmail.com" target="_blank" rel="noreferrer">v.piai.research@gmail.com</a>><br>
À: "FieldTrip discussion list" <<a href="mailto:fieldtrip@science.ru.nl" target="_blank" rel="noreferrer">fieldtrip@science.ru.nl</a>><br>
Cc: "Sami LAMECHE" <<a href="mailto:sami.lameche@imt-atlantique.net" target="_blank" rel="noreferrer">sami.lameche@imt-atlantique.net</a>>, "arnaud.preuilh" <<a href="mailto:arnaud.preuilh@sorbonne-universite.fr" target="_blank" rel="noreferrer">arnaud.preuilh@sorbonne-universite.fr</a>><br>
Envoyé: Mercredi 18 Juin 2025 14:19:02<br>
Objet: Re: [FieldTrip] Stroke lesion segmentation and SimBio MEX compilation issues on Ubuntu 22.04 (MATLAB R2022a)<br>
<br>
Hi Arnaud and Sami,<br>
<br>
I cannot speak to your second question, but re. the first one, from the top<br>
of my head (I can look up some of my code later if needed):<br>
In my experience (after fiddling with this for more than 5 years now...),<br>
what has been working relatively well for us is to use ft_volumesegment on<br>
your MRI, then read the binary lesion mask (and realign it to the MRI if<br>
you did some realignment there) and then manually add it to your<br>
segmentation, subtracting it from the rest of the segmentation (so for ex.<br>
if SPM segments certain voxels as GM and you add those manually as lesion,<br>
you need to set those voxels to 0, depending on what type of segmentation<br>
you're using, indexed or probabilistic). Also, if you're going to assign<br>
CSF conductivity for your lesion, then you could consider not adding it as<br>
a separate tissue, but rather add it into your CSF segmentation instead.<br>
The rest of the pipeline would remain the same, the head model will be<br>
prepared using this segmentation.<br>
<br>
I hope this helps,<br>
Vitoria<br>
<br>
On Wed, 18 Jun 2025 at 13:40, Sami LAMECHE via fieldtrip <<br>
<a href="mailto:fieldtrip@science.ru.nl" target="_blank" rel="noreferrer">fieldtrip@science.ru.nl</a>> wrote:<br>
<br>
> Dear FieldTrip team,<br>
><br>
> I am currently working on source reconstruction from EEG data in a patient<br>
> who has suffered a stroke. I am using FieldTrip on Ubuntu 22.04 with MATLAB<br>
> 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<br>
> (in NIfTI format) corresponding to the stroke area. I would like to include<br>
> this lesion as a separate tissue class in the segmentation process (e.g.,<br>
> alongside gray matter, white matter, CSF, skull, and scalp) to generate a<br>
> realistic headmodel.<br>
>    - Is there an official or recommended workflow in FieldTrip to<br>
> incorporate a lesion mask into `ft_volumesegment` or another segmentation<br>
> pipeline?<br>
>    - If not, what is the best way to manually integrate this lesion into<br>
> the segmentation structure in a way that remains compatible with headmodel<br>
> creation?<br>
><br>
> 2. SimBio MEX compilation issues on Ubuntu 22.04<br>
>    I am following the FEM pipeline described on the official FieldTrip<br>
> tutorial ([<br>
> <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%7C728ada24dd264cca8ed708ddaffa4d09%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638860211754580081%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=XNeQXvSBpAMvgdWZ9JPUvKIwRQSx0mHa5xpvCD2UQs0%3D&reserved=0" originalSrc="https://www.fieldtriptoolbox.org/tutorial/source/headmodel_eeg_fem/" rel="noreferrer 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>).<br>
> However, I encounter issues when trying to load the SimBio MEX files (when<br>
> 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<br>
> with MATLAB R2022a?<br>
> - Would you recommend specific compiler flags, patches, or an alternative<br>
> build process to successfully compile and use SimBio’s MEX files in this<br>
> 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%7C728ada24dd264cca8ed708ddaffa4d09%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638860211754606254%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=5CC5tsIi%2FR%2FLpItUeSQaWZZHQWyR5wI7SXnxRUzmYS8%3D&reserved=0" originalSrc="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer 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%7C728ada24dd264cca8ed708ddaffa4d09%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638860211754626260%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=fyWL%2FR05%2FhL8ayxOK9PmpCFewj7Igl6vVxhkze9AgNU%3D&reserved=0" originalSrc="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
></blockquote></div></div></div>