ants.ops.bias_correction
Functions
|
Truncate outlier intensities and bias correct with the N4 algorithm. |
|
N3 Bias Field Correction |
|
N3 Bias Field Correction |
|
N4 Bias Field Correction |
- abp_n4(image, intensity_truncation=(0.025, 0.975, 256), mask=None, usen3=False)[source]
Truncate outlier intensities and bias correct with the N4 algorithm.
ANTsR function: abpN4
- Parameters:
image (
ants.core.ANTsImage) – image to correct and truncateintensity_truncation (
typing.Tuple) – quantiles for intensity truncationmask (
ANTsImage (optional)) – mask for bias correctionusen3 (
bool) – if True, use N3 bias correction instead of N4
- Return type:
ants.core.ANTsImage
Example
>>> import ants >>> image = ants.image_read(ants.get_ants_data('r16')) >>> image2 = ants.abp_n4(image)
- n3_bias_field_correction(image, downsample_factor=3)[source]
N3 Bias Field Correction
ANTsR function: n3BiasFieldCorrection
- Parameters:
image (
ants.core.ANTsImage) – image to be bias correcteddownsample_factor (
scalar) – how much to downsample image before performing bias correction
- Return type:
ants.core.ANTsImage
Example
>>> import ants >>> image = ants.image_read( ants.get_ants_data('r16') ) >>> image_n3 = ants.n3_bias_field_correction(image)
- n3_bias_field_correction2(image, mask=None, rescale_intensities=False, shrink_factor=4, convergence={'iters': 50, 'tol': 1e-07}, spline_param=None, number_of_fitting_levels=4, return_bias_field=False, verbose=False, weight_mask=None)[source]
N3 Bias Field Correction
ANTsR function: n3BiasFieldCorrection2
- Parameters:
image (
ants.core.ANTsImage) – image to bias correctmask (
ants.core.ANTsImage) – Input mask. If not specified, the entire image is used.rescale_intensities (
bool) – At each iteration, a new intensity mapping is calculated and applied but there is nothing which constrains the new intensity range to be within certain values. The result is that the range can “drift” from the original at each iteration. This option rescales to the [min,max] range of the original image intensities within the user-specified mask. A mask is required to perform rescaling. Default is False in ANTsR/ANTsPy but True in ANTs.shrink_factor (
scalar) – Shrink factor for multi-resolution correction, typically integer less than 4convergence (
dict w/ keys `iters`and tol) – iters : maximum number of iterations tol : the convergence tolerance. Default tolerance is 1e-7 in ANTsR/ANTsPy but 0.0 in ANTs.spline_param (
floatorvector Parameter controlling numberofcontrol) – points in spline. Either single value, indicating the spacing in each direction, or vector with one entry per dimension of image, indicating the mesh size. If None, defaults to mesh size of 1 in all dimensions.number_of_fitting_levels (
int) – Number of fitting levels per iteration.return_bias_field (
bool) – Return bias field instead of bias corrected image.verbose (
bool) – enables verbose output.weight_mask (
ANTsImage (optional)) – antsImage of weight mask
- Return type:
ants.core.ANTsImage
Example
>>> image = ants.image_read( ants.get_ants_data('r16') ) >>> image_n3 = ants.n3_bias_field_correction2(image)
- n4_bias_field_correction(image, mask=None, rescale_intensities=False, shrink_factor=4, convergence={'iters': [50, 50, 50, 50], 'tol': 1e-07}, spline_param=None, return_bias_field=False, verbose=False, weight_mask=None)[source]
N4 Bias Field Correction
ANTsR function: n4BiasFieldCorrection
- Parameters:
image (
ants.core.ANTsImage) – image to bias correctmask (
ants.core.ANTsImage) – Input mask. If not specified, the entire image is used.rescale_intensities (
bool) – At each iteration, a new intensity mapping is calculated and applied but there is nothing which constrains the new intensity range to be within certain values. The result is that the range can “drift” from the original at each iteration. This option rescales to the [min,max] range of the original image intensities within the user-specified mask. A mask is required to perform rescaling. Default is False in ANTsR/ANTsPy but True in ANTs.shrink_factor (
scalar) – Shrink factor for multi-resolution correction, typically integer less than 4convergence (
dict w/ keys `iters`and tol) – iters : vector of maximum number of iterations for each level tol : the convergence tolerance. Default tolerance is 1e-7 in ANTsR/ANTsPy but 0.0 in ANTs.spline_param (
floatorvector) – Parameter controlling number of control points in spline. Either single value, indicating the spacing in each direction, or vector with one entry per dimension of image, indicating the mesh size. If None, defaults to mesh size of 1 in all dimensions.return_bias_field (
bool) – Return bias field instead of bias corrected image.verbose (
bool) – enables verbose output.weight_mask (
ANTsImage (optional)) – antsImage of weight mask
- Return type:
ants.core.ANTsImage
Example
>>> image = ants.image_read( ants.get_ants_data('r16') ) >>> image_n4 = ants.n4_bias_field_correction(image)