learning.RandomGain

learning.RandomGain#

class bartorch.learning.RandomGain#

Bases: RandomTransform, IntensityTransform

Multiply every image of a subject by one random complex gain.

The images are complex values laid out as real channels by as_real(), real parts first: a channel count of 2 k is k complex images. The gain is exp(s) exp(i phi), with phi uniform in phase and s uniform in log_scale, and the same for every image of the subject, so that a degraded input and its reference, or an image and the k-space made from it, stay consistent. The spatial transforms of torchio apply to the real and imaginary channels as they are, since interpolating each part is interpolating the complex value; its other intensity transforms do not respect the complex structure.

Parameters:
  • phase (float or tuple of float, default=pi) – Range of phi in radians; a single value d is (-d, d).

  • log_scale (float or tuple of float, default=0.0) – Range of s; a single value d is (-d, d).

  • **kwargs – Passed to torchio.transforms.Transform.

apply_transform()#

Apply the transform to a parsed subject.

Args:

subject: Subject to be modified by the transform.

Returns:

The transformed subject.