learning.RandomGain

learning.RandomGain#

class bartorch.learning.RandomGain#

Bases: RandomTransform, IntensityTransform

Multiply every image of a subject by one random complex gain (torchio transform).

The images hold complex values as real channels, laid out by as_real(): 2 k channels are k complex images, real parts first. The gain is \(e^{s} e^{i \varphi}\), with \(\varphi\) uniform in phase and \(s\) uniform in log_scale, the same for every image of the subject, so a degraded input and its reference stay consistent. torchio’s spatial transforms apply to the real and imaginary channels as they are; its other intensity transforms do not respect the complex structure.

Parameters:
  • phase (float or tuple of float, default=pi) – Range of \(\varphi\), 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.