Bad head shapes in Resting Omega tutorial

Hi, I'm reporting here an issue that a user mentioned and I reproduced.

When importing the data for the resting state OMEGA tutorial, it now seems to generate bad head surfaces (extreme example pictured). Did something change recently in this function? These MRIs are somewhat aggressively defaced, so maybe this impacts the threshold used to define the scalp surface? I'm not sure actually how this surface is generated as it is not present in the freesurfer folder and I'm not sure if it is automatically done by Brainstorm or SPM...

Any tips on how to fix this, or where this is done in the code?

Thanks!

This may be related to the recent changes in the mri histogram function.
Discussion Importantly, see the new option to manually define a threshold.
Commit

Note that some comments on the low importance of the head shape should be adjusted since this surface is sometimes used for head modeling.

Edit: I found an issue with that commit. Working on a fix. Will discuss that in the post above.

@Guiomar @Jeremym @Francois The MRIs in the raw folders have better face masking and better looking histograms than those in the freesurfer folder. On OpenNeuro it mentions that they were defaced with different functions which is odd. When importing the whole thing through the BIDS import, the MRI from the freesurfer folder is added last and used by default, creating the head surface from it. Could we fix this so the MRIs match between the raw and derivatives folders?

Once the fix is merged, you can fix this issue by:

  1. Copy the file path name of the MRI: From the anatomy tab, right click, file, copy file path to clipboard.
  2. On the Matlab command line: view_mri_histogram('path/to/MRI.mat', true) (paste the path you copied) You can close the histogram figure.
  3. Right click again on the MRI and select "generate head surface"

Done!

In the meantime, for the Resting state OMEGA tutorial, you can instead simply do step 3 on the MRI files named "sub-0006_ses-0001_T1w_spm" instead of "MRI". These work fine as is and actually look better (cleaner face masking).

Problem fixed in this commit:
https://github.com/brainstorm-tools/brainstorm3/commit/25732db0073a343411ea2c88bebb5686873e41f9

The background removal detection added recently was removed. Only the manual definition of the threshold was kept.
To recompute the histogram for the MRI and get a fixed "guessed background theshold" when generating the head surface, simply display the histogram (right-click on the MRI > Display > Histogram)