New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine ANTs brain mask with FreeSurfer #431

Closed
chrisfilo opened this Issue Apr 3, 2017 · 14 comments

Comments

Projects
None yet
4 participants
@chrisfilo
Contributor

chrisfilo commented Apr 3, 2017

Sometimes ANTs brainmasks fails
image
ds114 subject 01

However we can use the refined brainmask obtained from the FreeSurfer reconstruction (like here: https://github.com/BIDS-Apps/nipypelines/blob/master/run.py#L401)

@effigies

This comment has been minimized.

Collaborator

effigies commented Apr 4, 2017

We inject the ANTs brainmask before aparc occurs.

@effigies

This comment has been minimized.

Collaborator

effigies commented Apr 4, 2017

Well, I suppose as long as it only ever fails by including too much and never too little, we can use it.

@chrisfilo

This comment has been minimized.

Contributor

chrisfilo commented Apr 4, 2017

@effigies

This comment has been minimized.

Collaborator

effigies commented Apr 4, 2017

So the idea is to continue to inject ANTs as a prior, and then let a binarized aparc be the final mask we use?

That should be pretty easy. I assume we don't want to turn around and use the updated mask to fix recon-all.

@chrisfilo

This comment has been minimized.

Contributor

chrisfilo commented Apr 4, 2017

@chrisfilo

This comment has been minimized.

Contributor

chrisfilo commented Apr 4, 2017

So I've tried this last night and the problem I run into is that the aparc based mask is too tight and needs to be dilated. However, when you dilate it (even when using one voxel) the result is worse (includes more non-brain) than the initial ANTs mask.

@effigies

This comment has been minimized.

Collaborator

effigies commented Apr 4, 2017

What about setting the mask to sum(dilated_aparc + ANTs) == 2?

@oesteban

This comment has been minimized.

Contributor

oesteban commented May 5, 2017

I'd bet @binarybottle's opinion on this will be very valuable to make a decision here. Arno, can we ask you what do you think about FreeSurfer's and ANTS' brain masks? And how to combine them?

@binarybottle

This comment has been minimized.

binarybottle commented May 5, 2017

Thanks for asking! Because I have also found FreeSurfer and ANTs to under- and over-segment as mentioned above, I wrote the following function to try and reconcile the two:
https://github.com/nipy/mindboggle/blob/master/mindboggle/guts/segment.py#L1660

The docstring says::

Combine the voxels of one label from two files and overlay them
on the second label combined from the two files.

An example application is to combine two segmentation volumes,
such as from FreeSurfer and ANTs, to obtain a single cortex=2
and noncortex=3 segmentation file, by taking the union of cortex voxels
from the segmentations, the union of the noncortex voxels from the
segmentations, and overwriting intersecting cortex and noncortex voxels
with noncortex (3) labels.

ANTs tends to include more cortical gray matter at the periphery of
the brain than Freesurfer, and FreeSurfer tends to include more white
matter that extends deep into gyral folds than ANTs, so this function
attempts to remedy their differences by overlaying ANTs cortical gray
with FreeSurfer white matter.

Example preprocessing steps ::

   1. Run Freesurfer and antsCorticalThickness.sh on T1-weighted image.
   2. Convert FreeSurfer volume labels (e.g., wmparc.mgz or aparc+aseg.mgz)
       to cortex (2) and noncortex (3) segments using relabel_volume()
       function [refer to labels.rst or FreeSurferColorLUT labels file].
   3. Convert ANTs Atropos-segmented volume (tmpBrainSegmentation.nii.gz)
       to cortex and noncortex segments, by converting 1-labels to 0 and
       4-labels to 3 with the relabel_volume() function
       (the latter is to include deep-gray matter with noncortical tissues).
@chrisfilo

This comment has been minimized.

Contributor

chrisfilo commented Dec 19, 2017

Here's another example where freesurfer mask could be used to refine the ANTs one

ANTs
image

FreeSurfer
image

It's subject 010125 from ds000221 (MP2RAGE acqusition).

@chrisfilo

This comment has been minimized.

Contributor

chrisfilo commented Dec 19, 2017

Another case
image

ds000017/sub-2

@oesteban

This comment has been minimized.

Contributor

oesteban commented Dec 19, 2017

Well, I would not include MP2RAGE here. We could try to generate a template for MP2RAGE adding noise around the head.

@oesteban

This comment has been minimized.

Contributor

oesteban commented Dec 27, 2017

Alright, I think we are getting to something functional on #912. There is a combination of Arno's ideas and some new.

The problem I could not think a solution for is when ANTs cuts out the outermost bend of some gyri. That happens from time to time.

@chrisfilo

This comment has been minimized.

Contributor

chrisfilo commented Dec 29, 2017

For the MP2RAGE case it might be worth trying one of the inversion images instead of the T1w image. See poldracklab/pydeface#15 for more insights.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment