Error when masking fmriprep outputs - blank brain mask


I’ve encountered some issues when attempting to skull strip the images using the brain mask provided by the fmriprep output. The resulting image is completely blank, and when opening up the brain mask file it also looks completely blank. Either something must have gone wrong when fmriprep was creating the brain mask, I’m not applying the mask correctly, or I’m not viewing the file correctly. I used fslmaths -mas command and it ran without error.

Another point of confusion is that in the html reports for each subject, it seems to have correctly generated the mask - I’ve attached a snippet from the first svg file. So I’m not sure why the mask is displaying as blank, and why the resulting “skull stripped” image is also completely blank.

Here is the format of the command I ran:
/usr/local/miniconda/bin/fmriprep /data /out participant --participant-label 02 --anat-only --fs-no-reconall
And it said fmriprep completedd with no errors.

And here are the files that I used to try to skull strip:

Any help would be appreciated.

Hello @himaniyadav
I am having a similar problem and I think I have spotted something. The question is have you checked the fsl header?
A bit of context why I am asking that (sorry for the long story). I have a dataset and have run the preprocessing with two versions: 1.3.1 and 1.3.4. I can analyze the images from 1.3.1 just fine, but fail with the images of 1.3.4. After some detective work, I tracked the error down to the mask.
So, when I open the mask (1.3.4) with fsleyes and it seems fine. However, when I attempt to read the file with Matlab, it returns only NaNs. I checked the header using fslhd and the only difference is in the fields “scl_scope” and “scl_inter”: the 1.3.4 mask has NaN assigned to this field. These fields are used to scale and interpolate the value of each voxel (more info here: View Document — Neuroimaging Informatics Technology Initiative). Anyways, since in my mask header, the fields are NaNs, Matlab reads the mask as NaNs.
If this is your problem, the fix is simple. I used fsledithd to modify the header to “scl_scope=1” and “scl_inter=0”. After that, Matlab processed the masks with no problems.
By the way, @oesteban have you heard of something similar? I am only aware of this problem with v1.3.4. and thought you may be interested in knowing. Please let me know if I should report it somewhere.

I think this replicates BUG: scl_slope/scl_inter in mask and dseg headers are set to nan, should be 1/0.