MP2RAGE background removal in LEMON dataset

Dear all,

I’ve recently started working with the LEMON dataset (http://fcon_1000.projects.nitrc.org/indi/retro/MPI_LEMON.html ) that uses MP2RAGE sequence. I have difficulty with removing the background. The supporting paper for this dataset mentions CBS tools for background removal but I could not install and run CBS tools as a plugin for MIPAV, nor could I successfully run the nipype project provided here: pipelines/src/lsd_lemon at master · NeuroanatomyAndConnectivity/pipelines · GitHub

Does anyone have recommendations for removing background from T1 images recorded through MP2RAGE sequence?

Thank you very much for your time and help.

Best Regards,
Mahta

MRI scans tend to exhibit a bit of noise in the air outside the object. Removing this can make the images much smaller if you save them as compressed files (e.g. .nii.gz) and can be a bit visually distracting. However, I would be wary of removing this signal from data that is fed into a complex processing pipeline without carefully considering the option. There may be some unexpected consequences:

  1. This noise may be meaningful for attenuating Gibbs artifacts.
  2. Tools like SPM 6-tissue unified segmentation and normalization model different tissue as a mixture of gaussians. You would be artificially reducing the variability of the air outside the object, which might impact how air is modeled at the interface of tissues.
  3. Tools like SPM often treat zero values as an implicit mask, and this may behave differently than not having a mask.

So my sense is that you want to think carefully of what background removal will achieve, and whether doing so will impact any of the subsequent tools. If you do want to explicitly mask your data, you may want to consider a tool like FSL’s BET or using SPM’s segmentation.

By the way, while I retain haze in our T1 scans, I do remove it when visualizing the data with volume rendering. The image below shows a T1 scan rendering using MRIcroGL. The left panel is the raw data, the right panel shows the impact of choosing Remove Haze from the View menu:

Thanks a lot for your response @Chris_Rorden, I appreciate your help. I need to extract/mask the brain in the T1 image so that I can do tissue segmentation that will later be used for tractography of the dwi data for which I’m using the mrtrix toolbox. I’ve tried FSL BET but could not set the parameters right. I’ve also tried ROEX toolbox and the mask isn’t good enough. In the attached image, I’m plotting the T1 weighted image for one subject overlayed with the mask in red. I suspect that the grainy background may be the issue as I’ve not had this problem for other datasets.

I think the primary issue here is that your T1 scan includes far more neck tissue than the typical templates and the heuristics for most of the algorithms.

Here are a couple of suggestions.

  • For future scans, consider a sequence that restricts the field of view to regions you are interested in.
  • For tools like SPM, which use the SForm origin as a starting estimate for normalization, make sure the origin is set near the anterior commissure. You can do this manually or with the tool like ACPC detect.
  • For tools like FSL’s BET and FLIRT, be aware that they will use the center of brightness as the starting estimate, this will be biased if there is excess neck. You could try setting the origin and using the usesqform option. Alternatively, you could crop your images to remove excess neck.
    • dcm2niix has a crude algorithm that often works, you simply convert your images with the -x y option.
    • MRIcroGL’s Import/Tools/Crop menu item allows you to interactively crop excess neck from your image. FSLeyes has a similar tool.
    • spm’s normalization algorithms are very sensitive to the amount of neck in an image (though SPM12’s 6-tissue template is superior to older versions). You could try the spm masking script. However, I often find that SPM’s coregistration is particularly robust, and often this is could for both setting the origin and optionally cropping the excess neck. Both are possible with this script.

For almost all neuroimaging cases, excess neck signal is a nuisance that will hinder your work. However, for completeness, some people want images with neck for modeling electrical currents. In this case, you may want to consider a template that is extended to include the neck.

1 Like

Thank you very much for your response and the information. I appreciate your help.
The dataset is a public one that I’m using, but I’ll certainly keep that in mind with respect to T1 imaging for my upcoming study.

I found the following link on another discussion topic for removing background noise of the MP2RAGE image: GitHub - JosePMarques/MP2RAGE-related-scripts: MP2RAGE Scripts - T1 map correction & Background no

It needs the INV1 and INV2 images to do so and works great!

Best Regards,
Mahta

1 Like

Hi-

I have recently looked at the MPI-Lemon data a bit for processing. Here is an example of combined skullstripping (SS) and nonlinear warping to a template (the MNI 152) for their sub-032301, using AFNI’s @SSwarper. Because this is a nonstandard T1w volume, as you have pointed out (elevated background noise outside the brain), I tried a few different things. The @SSwarper tool creates automatic QC images, and I will show one of where the brain boundary is found for each case.

NB: in each case below, I am using tcsh syntax for a couple variables and to capture terminal text output in a log file; but those parts can be turned into any kind of scripting you prefer.

Case 1: default options

set subj = sub-032301
set anat = ${subj}_ses-01_acq-mp2rage_T1w.nii.gz
time @SSwarper                               \
    -input  ${anat}                          \
    -base   MNI152_2009_template_SSW.nii.gz  \
    -subid  ${subj}                          \
    -odir   aw_${subj}                       \
    |& tee log_aw_${subj}

… which produces pretty good results:


… and just to give a sense of the alignment associated with this—for this run, the following image shows the anatomical warped to the chosen standard space, with the edges of the MNI template overlaid (also pretty good):

If the skullstripping is good, typically the alignment is good, and vice versa, because this program is toggling back and forth between both operations to improve both.

Case 2: put in an opt to turn off initial skull stripping in the program, because the high-background makes this not very good (note how the default above still did quite well, even so, by the end):

set subj = sub-032301
set anat = ${subj}_ses-01_acq-mp2rage_T1w.nii.gz
time @SSwarper                               \
    -input  ${anat}                          \
    -base   MNI152_2009_template_SSW.nii.gz  \
    -subid  ${subj}                          \
    -odir   aw2_${subj}                       \
    -init_skullstr_off                       \
    |& tee log_aw2_${subj}

Case 4 (yes, #3 wasn’t very useful in output): use an accompanying dataset in the MPI-Lemon anat/ folder to punch away some of the background—specfically the “*inv-2_mp2rage.nii.gz” dset, which itself has a relatively low background. This is done with automasking using a very low clipping fraction, to preserve as much brain as possible there (some of these dsets also have brightness inhomogeneity). Then use that automasking to punch away background (hopefully) from the T1w volume using 3dcalc:

set subj = sub-032301
set anat = ${subj}_ses-01_acq-mp2rage_T1w.nii.gz

3dAutomask \
    -overwrite \
    -prefix big_mask.nii \
    -clfrac 0.1  \
    sub-032301_ses-01_inv-2_mp2rage.nii.gz

3dcalc \
    -overwrite \
    -a big_mask.nii \
    -b ${anat} \
    -expr 'step(a)*b' \
    -prefix anat_masked.nii.gz

time @SSwarper                               \
    -input  anat_masked.nii.gz               \
    -base   MNI152_2009_template_SSW.nii.gz  \
    -subid  ${subj}                          \
    -odir   aw4_${subj}                      \
    #-unifize_off                 \
    -SSopt '-blur_fwhm 2'                    \
    |& tee log_aw4_${subj}

Case 5: employing similar, loose “pre-masking” of background, with adding in a couple options to @SSwarper:

set subj = sub-032301
set anat = ${subj}_ses-01_acq-mp2rage_T1w.nii.gz

3dAutomask \
    -overwrite \
    -prefix big_mask.nii \
    -clfrac 0.1  \
    sub-032301_ses-01_inv-2_mp2rage.nii.gz

3dcalc \
    -overwrite \
    -a big_mask.nii \
    -b ${anat} \
    -expr 'step(a)*b' \
    -prefix anat_masked.nii.gz

time @SSwarper                               \
    -input  anat_masked.nii.gz               \
    -base   MNI152_2009_template_SSW.nii.gz  \
    -subid  ${subj}                          \
    -odir   aw5_${subj}                      \
    -unifize_off                 \
    -SSopt '-blur_fwhm 2'                    \
    |& tee log_aw5_${subj}

Most of these results seem good-to-quite-good, I think. There are little blips around in each case, perhaps, but overall they seem to do a good job. Plus, you get alignment to standard space calculated simultaneously!

–pt

2 Likes

Thanks a lot @ptaylor for your response. Yes, I believe that INV1 and INV2 scans are necessary for a reliable background noise removal. I found this toolbox very helpful: https://github.com/JosePMarques/MP2RAGE-related-scripts

Segmentation or masking of the brain was much more reliable after denoising.

Best Regards,
Mahta

Hello,Would you mind showing me how to use this scripts. Thank you very much.
GitHub - JosePMarques/MP2RAGE-related-scripts: MP2RAGE Scripts - T1 map correction & Background no

Hi, welcome to Neurostars!

I think the first step is to download the project and edit one of the demo scripts with the path to your data.

Why do you want to use those scripts for? Background removal, T1 map calculation?

Here are a few other programs doing similar things using similar or different methods:

1 Like

For MP2RAGE, I use bet in fsl, no matter how much I adjust the threshold, it always leaves out brain tissue and noise.
I would like to know if these methods you provide can effectively remove the scalp and brain tissue.
Thank you for providing solution and advice.

Yes, it is a bit tricky to get a good brain mask from MP2RAGE images.

Here are some different options (among many others!) you can try, to see what best fits your needs:

  • FSL-BET on the INV-2 image and apply that to the UNIT1 image.
  • Remove background of the image with your favorite method and treat it like a T1w image, then:
    – Basic method: use FSL-BET on this T1w image (may need a different threshold than a regular T1w image
    SynthStrip
    presurfer
    – use fmriprep : it uses a Nipype implementation of the antsBrainExtraction.sh
    – use HD-BET
    – use optiBET

Hello, Julien:
The solution you provided is really fantastic.
You help me solve a problem that had been bothering me all week.
Thank you very much.

1 Like

I am very glad I could help.
This looks indeed like a satisfying result. Which solution did you choose in the end?

I ended up choosing “presurfer”, which turned out to be the most satisfying.

1 Like

ya presurfer is great. some extra developer bells and whistles there but the core is simply (in AFNI tcsh but could be easily adapted to most programs):

set INV2 = INV2.nii.gz # aka the “PD” image
set anat = UNI.nii.gz # aka the noisy T1

3dUnifize -prefix INV2uni.nii $INV2

set max = ‘3dinfo -dmaxus INV2uni.nii’
set min = ‘3dinfo -dminus INV2uni.nii’
3dcalc -a INV2uni.nii -expr “(a-$min) / ($max - $min)” -prefix inv2uniNorm.nii

3dcalc -a inv2uniNorm.nii -b $anat -expr ‘a*b’ -prefix UNI_NoBckgrndNoise.nii

((where max and min are there defined with the backtick not single quote, but the website automatically turned it into a misleading font change))

1 Like

I‘ll try the way you provided.
Thank you very much.

It is my first time to use matlab.
I would like to ask how to use the for loop to implement batch processing in matlab.
Is there a batch script for me to learn?
Thank you.

Unfortunately I didn’t do more than testing this script and I didn’t write a batch script to process several subjects. But it should not be too difficult, if you start from the presurfer_example.m script.

Good luck!

1 Like

Thank you very much.
I am writing and testing a script for dealing with the datasets of multiple subjects by using for-loop in the presurfer_example.m script.

Hello,
I wonder which article the “presurfer” script is based on.
Is it based on the method from" Robust T1-Weighted Structural Brain Imaging and Morphometry at 7T Using MP2RAGE"?
Thank you.

1 Like