[FieldTrip] Stroke lesion segmentation and SimBio MEX compilation issues on Ubuntu 22.04 (MATLAB R2022a)

Sami LAMECHE sami.lameche at imt-atlantique.net
Wed Jun 18 12:59:59 CEST 2025


Dear FieldTrip team,

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:

1.Stroke lesion segmentation  
   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.  
   - Is there an official or recommended workflow in FieldTrip to incorporate a lesion mask into `ft_volumesegment` or another segmentation pipeline?
   - 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?

2. SimBio MEX compilation issues on Ubuntu 22.04
   I am following the FEM pipeline described on the official FieldTrip tutorial ([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)). However, I encounter issues when trying to load the SimBio MEX files (when doing ft_prepare_headmodel) on Ubuntu 22.04 with MATLAB R2022a.  
   Specifically, I receive the following error:

Invalid MEX-file '.../calc_stiff_matrix_val.mexa64':
... wrong ELF class, or undefined symbol, or GLIBC_x.x not found ...

- Are there known compatibility issues with SimBio and Ubuntu 22.04 or with MATLAB R2022a?
- Would you recommend specific compiler flags, patches, or an alternative build process to successfully compile and use SimBio’s MEX files in this setup?

Any suggestions, workarounds, or reference materials would be very helpful.

Best regards,  
Arnaud Preuilh & Sami Lameche  
LIB



More information about the fieldtrip mailing list