learning.RandomGain#
- class bartorch.learning.RandomGain#
Bases:
RandomTransform,IntensityTransformMultiply 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 of2 kiskcomplex images. The gain isexp(s) exp(i phi), withphiuniform inphaseandsuniform inlog_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 oftorchioapply 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
phiin radians; a single valuedis(-d, d).log_scale (float or tuple of float, default=0.0) – Range of
s; a single valuedis(-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.