Helper Module for Deep Learning.
Module that defines common tools to deal with spatial transformations. Code: https://github.com/matthew-brett/transforms3d Code: https://github.com/bsciolla/gaussian-random-fields
-
pynet.augmentation.transform.affine_flow(affine, shape)[source]¶ Generates a flow field given an affine matrix.
- Parameters
affine: Tensor (4, 4)
an affine transform.
shape: tuple
the target output image shape.
- Returns
flow: Tensor
the generated affine flow field.
-
pynet.augmentation.transform.compose(T, R, Z, S=None)[source]¶ Compose translations, rotations, zooms, [shears] to affine
- Parameters
T: array (N,)
translations, where N is usually 3 (3D case)
R: array (N, N)
rotation matrix where N is usually 3 (3D case)
Z: array (N,)
zooms, where N is usually 3 (3D case)
S: array (P,), default None
shear vector, such that shears fill upper triangle above diagonal to form shear matrix. P is the (N-2)th Triangular number, which happens to be 3 for a 4x4 affine (3D case)
- Returns
A: array (N+1, N+1)
affine transformation matrix where N usually == 3 (3D case)
-
pynet.augmentation.transform.fftind(shape)[source]¶ Returns a numpy array of shifted Fourier coordinates.
- Parameters
shape: uplet
the shape of the coordinate array to create.
- Returns
k_ind: array (2, size, size) with:
shifted Fourier coordinates.
-
pynet.augmentation.transform.gaussian_random_field(shape, alpha=3.0, normalize=True, seed=None)[source]¶ Generates 3D gaussian random maps. The probability distribution of each variable follows a Normal distribution.
- Parameters
shape: uplet,
the shape of the output Gaussian random fields.
alpha: flaot, default 3
the power of the power-law momentum distribution.
normalize: bool, default True
normalizes the Gaussian field to have an average of 0.0 and a standard deviation of 1.0.
seed: int, default None
seed to control random number generator.
- Returns
gfield: array
the gaussian random field.
Follow us
Inspired by AZMIND template.