Importing SimNIBS M2M folder

Dear Brainstorm team,

I was working on a little tool for myself to generate SimNIBS folders and loading them in brainstorm automatically in Matlab. I was running into some problems when multiple M2M folders were present in a parent folder. In that case multiple .msh files and _T1fs_conform.nii.gz files are present and an error is thrown.

I was thinking if it wouldn't be easier to select the M2M folder directly instead of the parent directory.I don't think this will be a lot of changes in the code, I was a bit too quick with my previous suggestion of just 2 lines (which is edited away).

It is too bad that the .msh file is not automatically placed in the folder as well, however with the folder name it is quite trivial to pick out the correct .msh file in the parent directory.

PS: there is a small typo in line 146 where the error message for a file not found is 'Mesh file *.msh found in top folder.

Kind regards,

Is it a good idea to have one folder with multiple .msh file / m2m folders?
Is SimNIBS expecting you to work with multiple segmentations within one subject folder?

@tmedani Any suggestion?

I must admit that I don't know if it's a good idea. SimNibs doesn't expect it from what i know. If it is inherently a bad idea I will change things at my side in the folder structure.

I thought it would be more convenient to select the M2M folder as a starting point when loading in the anatomy. One of the use cases that I have is for example inspecting the difference with just a T1 segmentation and then a T2 added, which is easier automated in the same folder. Of course I can do this by changing my own folder structure and it would be perfectly fine for me to work on that myself.

The .msh file is the main output file we are interested in and it is located at the same level as the m2m folder (which is a subproduct of the segmentation process, not the final output), therefore the entry point must be the parent folder.

I think it would be more logical to use a folder organization similar to what is done in FreeSurfer, CAT or BrainSuite: one subject = one folder = one segmentation.
If you want to compare the T1 vs. T1+T2 reconstrution, just like with FreeSurfer, you create two subjects.

Other nested solutions would make it more difficult to track/parse by other programs.

1 Like

That's clear for me indeed. Then I'll use the current system as is and use multiple subjects. My apologies for the confusion surrounding this subject from my side. Thanks a lot for the quick answers !