Denoising a T1 image outside of the surface

I am trying to remove these extreme values outside of the real tissue (ie. skull) using SPM segmentation outputs, and I have been partially successful but I am not able to remove the noise below the nose.

Is there a more robust segmentation method (or do any of you have any suggestions as a seperate approach?

I tried using FSL BET outputs, but the skull surface is not that demarcated either.

Hi @Tamer_Gezici,

To clarify, are you just looking to skull strip your image? If so, you make have better luck using ANTs or SynthSeg from FreeSurfer.


Hi Steven,

Thanks. No, actually I need everything! What I don’t need is this “noise” that is outside of the person’s head (I need the skull and skin included)

Are these 3D mprage images or UNI images from an mp2rage?

It is a regular MPRAGE image converted to NIfTI. I was using MRIcroGL, setting the contrast 0 to 10 to see how much this noise was affecting the image (and it was a lot). The image needed to be uploaded to some software, which didn’t like the noise around the head so I was looking for ways to get rid of it.

Thanks for your answers. I was able to solve the issue myself.

I used the t1_brain_outskin_mask.nii generated by FSL’s skull stripping. The issue is this mask is also not perfect, as I needed anatomical features such as the mouth, ears and nose. So I used a CV method called “binary dilation” to dilate the mask (basically make it a little bigger) to get those anatomical features. Using this mask, we can exclude what is left out of the mask using some array operations and it worked.

It might be worth starting out describing what your objective is with this segmentation. If this is simply to improve visualization you can choose Remove Haze from MRIcroGL’s View option:

This removes background noise using a multi-Otsu method. However, I would only use this for visualization and not subsequent processing: segmentation often uses a difference of Gaussian approach where you want to be able to estimate the variance of error in measuring air. Setting all presumed air voxels to zero will artificially reduce this estimate.

If you want to improve the segmentation of the jaw and other inferior features (e.g. for better tDCS or ERP source measurements), you should consider using a template with a wider field of view. Huang et al. provide an extended FoV template you can use with SPM. It is included as eTPM.nii with ROAST, and you can either use ROAST or use the template directly with SPM. The image below shows the default SPM template (left) and the extended template (right). There may be tradeoffs for brain segmentation, so I would use this approach if it is specifically required by your application.

1 Like

In AFNI, you could use 3dAutomask to do a simple mask of the dataset to remove outside haziness.

3dAutomask -apply_prefix anat_am.nii.gz anat.nii.gz

You can visualize with volume rendering in suma:

suma -vol anat_am.nii.gz


I tried this, and it removed some much needed skin and skull surfaces as well.

@neurolabusc thanks for your answer!

Right now I seem to have a temp. solution (using FSL out skin mask and then dilating a little to account for bordering errors) I will need to test it with the specific neuronavigation system that the image will be uploaded and see what happens.

Your datasets might need a little tweaking with this command then. Some image dilation could work. Here is an example with both dilation and erosion:

3dAutomask -apply_prefix anat_am_d3e3 -dilate 3 -erode 3 anat+orig.

There are a fair number of options that you can explore for further tweaking.

1 Like