ANTsX / ANTsR

R interface to the ANTs biomedical image processing library
https://antsx.github.io/ANTsR
Apache License 2.0
127 stars 35 forks source link

Masking in ANTsR abpN4 vs. N4BiasFieldCorrection (shell) #318

Closed vnckppl closed 4 years ago

vnckppl commented 4 years ago

I am wondering how a mask is being applied in abpN4. In N4BiasFieldCorrection there are two options for using a mask:

-x, --mask-image maskImageFilename If a mask image is specified, the final bias correction is only performed in the mask region. If a weight image is not specified, only intensity values inside the masked region are used during the execution of the algorithm. If a weight image is specified, only the non-zero weights are used in the execution of the algorithm although the mask region defines where bias correction is performed in the final output. Otherwise bias correction occurs over the entire image domain. See also the option description for the weight image. If a mask image is not specified then the entire image region will be used as the mask region. Note that this is different than the N3 implementation which uses the results of Otsu thresholding to define a mask. However, this leads to unknown anatomical regions being included and excluded during the bias correction.

 -w, --weight-image weightImageFilename
      The weight image allows the user to perform a relative weighting of specific
      voxels during the B-spline fitting. For example, some studies have shown that N3
      performed on white matter segmentations improves performance. If one has a
      spatial probability map of the white matter, one can use this map to weight the
      b-spline fitting towards those voxels which are more probabilistically
      classified as white matter. See also the option description for the mask image.

I am wondering if specifying a mask with abpN4 results in the N4 correction only being applied to voxels within the mask (option -x), or the masked region being used for the estimation of the bias field, but the application of the correction is applied to the entire image (option -w).

I am specifically interested in the latter.

vnckppl commented 4 years ago

Never mind. Reading through abpN4 I notice it calls n4BiasFieldCorrection which does have a 'weight_mask' option.