Menu

Helper Module for Deep Learning.

Common functions to change image intensities. Code: https://github.com/fepegar/torchio

pynet.augmentation.intensity.add_biasfield(arr, coefficients=0.5, order=3, seed=None)[source]

Add random MRI bias field artifact.

Parameters

arr: array

the input data.

coefficients: float, default 0.5

the magnitude of polynomial coefficients.

order: int, default 3

the order of the basis polynomial functions.

seed: int, default None

seed to control random number generator.

Returns

transformed: array

the transformed input data.

pynet.augmentation.intensity.add_blur(arr, snr=None, sigma=None, seed=None)[source]

Add random blur using a Gaussian filter.

Parameters

arr: array

the input data.

snr: float, default None

the desired signal-to noise ratio used to infer the standard deviation for the noise distribution.

sigma: float or 2-uplet

the standard deviation for Gaussian kernel.

seed: int, default None

seed to control random number generator.

Returns

transformed: array

the transformed input data.

pynet.augmentation.intensity.add_ghosting(arr, axis, n_ghosts=10, intensity=1, seed=None)[source]

Add random MRI ghosting artifact.

Parameters

arr: array

the input data.

axis: int

the axis along which the ghosts artifact will be created.

n_ghosts: int or 2-uplet, default 10

the number of ghosts in the image. Larger values generate more distorted images.

intensity: float or list of float, default 1

a number between 0 and 1 representing the artifact strength. Larger values generate more distorted images.

seed: int, default None

seed to control random number generator.

Returns

transformed: array

the transformed input data.

pynet.augmentation.intensity.add_motion(arr, rotation=10, translation=10, n_transforms=2, perturbation=0.3, axis=None, seed=None)[source]

Add random MRI motion artifact on the last axis.

Reference: Shaw et al., 2019, MRI k-Space Motion Artefact Augmentation: Model Robustness and Task-Specific Uncertainty.

Parameters

arr: array

the input data.

rotation: float or 2-uplet, default 10

the rotation in degrees of the simulated movements. Larger values generate more distorted images.

translation: floatt or 2-uplet, default 10

the translation in voxel of the simulated movements. Larger values generate more distorted images.

n_transforms: int, default 2

the number of simulated movements. Larger values generate more distorted images.

perturbation: float, default 0.3

control the intervals between movements. If perturbation is 0, time intervals between movements are constant.

axis: int, default None

the k-space filling axis. If not specified, randomize the k-space filling axis.

seed: int, default None

seed to control random number generator.

Returns

transformed: array

the transformed input data.

pynet.augmentation.intensity.add_noise(arr, snr=None, sigma=None, noise_type='gaussian', seed=None)[source]

Add random Gaussian or Rician noise.

The noise level can be specified directly by setting the standard deviation or the desired signal-to-noise ratio for the Gaussian distribution. In the case of Rician noise sigma is the standard deviation of the two Gaussian distributions forming the real and imaginary components of the Rician noise distribution.

In anatomical scans, CNR values for GW/WM ranged from 5 to 20 (1.5T and 3T) for SNR around 40-100 (http://www.pallier.org/pdfs/snr-in-mri.pdf).

Parameters

arr: array

the input data.

snr: float, default None

the desired signal-to noise ratio used to infer the standard deviation for the noise distribution.

sigma: float or 2-uplet, default None

the standard deviation for the noise distribution.

noise_type: str, default ‘gaussian’

the distribution of added noise - can be either ‘gaussian’ for Gaussian distributed noise, or ‘rician’ for Rice-distributed noise.

seed: int, default None

seed to control random number generator.

Returns

transformed: array

the transformed input data.

pynet.augmentation.intensity.add_offset(arr, factor, seed=None)[source]

Add a random intensity offset (shift and scale).

Parameters

arr: array

the input data.

factor: float or 2-uplet

the offset scale factor [0, 1] for the standard deviation and the mean.

seed: int, default None

seed to control random number generator.

Returns

transformed: array

the transformed input data.

pynet.augmentation.intensity.add_spike(arr, n_spikes=1, intensity=(0.1, 1), seed=None)[source]

Add random MRI spike artifacts.

Parameters

arr: array

the input data.

n_spikes: int, default 1

the number of spikes presnet in k-space. Larger values generate more distorted images.

intensity: float or 2-uplet, default (0.1, 1)

Ratio between the spike intensity and the maximum of the spectrum. Larger values generate more distorted images.

seed: int, default None

seed to control random number generator.

Returns

transformed: array

the transformed input data.

Follow us

© 2019, pynet developers .
Inspired by AZMIND template.