ants.deeplearn.simulate_bias_field

simulate_bias_field(domain_image, number_of_points=10, sd_bias_field=1.0, number_of_fitting_levels=4, mesh_size=1)[source]

Simulate random bias field

Low frequency, spatial varying simulated random bias field using random points and B-spline fitting.

Parameters:
  • domain_image (ants.core.ANTsImage) – Image to define the spatial domain of the bias field.

  • number_of_points (int) – Number of randomly defined points to define the bias field (default = 10).

  • sd_bias_field (float) – Characterize the standard deviation of the amplitude (default = 1).

  • number_of_fitting_levels (int) – B-spline fitting parameter.

Return type:

ANTs image

Example

>>> import ants
>>> import numpy as np
>>> image = ants.image_read(ants.get_ants_data("r64"))
>>> log_field = ants.simulate_bias_field(image, number_of_points=10, sd_bias_field=1.0,
...    number_of_fitting_levels=2, mesh_size=10)
>>> log_field = log_field.iMath("Normalize")
>>> field_array = np.power(np.exp(log_field.numpy()), 4)
>>> image = image * ants.from_numpy(field_array, origin=image.origin,
...    spacing=image.spacing, direction=image.direction)