ANTsX / ANTsRNet

Medical image analysis framework merging ANTsR and deep learning
Apache License 2.0
63 stars 18 forks source link

Poor results in brainExtraction #40

Closed ntustison closed 3 years ago

ntustison commented 3 years ago

Sometimes brainExtraction gives poor results---specifically, nonzero probabilities in the face area. This is due to the training data, in many cases, being defaced. In the short term before adding more training data, in order to improve results for such cases, one can modify the input t1 as follows:

t1 <- antsImageRead(t1_file)

kirby <- antsImageRead(getANTsXNetData("kirby"))
kirby_mask <- thresholdImage(brainExtraction(kirby, modality = "t1", verbose=TRUE), 0.5, 1, 1, 0)
kirby_dilated_mask <- iMath(kirby_mask, "MD", 25)

reg <- antsRegistration(fixed=t1, moving=kirby, typeofTransform="antsRegistrationSyNQuick[a]") 
t1_dilated_mask <- antsApplyTransforms(fixed=t1, moving=kirby_dilated_mask, 
    transformlist=reg$fwdtransforms, interpolator="nearestNeighbor")

t1_defaced <- t1 * t1_dilated_mask   
mask <- brainExtraction(t1_defaced, modality="t1")
stnava commented 3 years ago

@ntustison do you have example ADNI images for which this occurs?

this option might also work

b1=brainExtraction(img, 't1combined' )
b2=brainExtraction( img * iMath( thresholdImage(b1,2,3), "MD", 25 ), "t1combined" )
finabxt = thresholdImage(b2,2,3) %>% iMath("MD",1)
ntustison commented 3 years ago

Yeah, a handful of subjects from James' recent data set have that problem. Let me see if it works.

ntustison commented 3 years ago

It looks like it works for the one case I tried:

Screen Shot 2021-01-14 at 10 55 16 AM
ntustison commented 3 years ago

https://github.com/ANTsX/ANTsRNet/commit/bdc79ce324a7fe568b323ce30d8adf2602bee5f3