optim.data_scaling

optim.data_scaling#

bartorch.optim.data_scaling()#

Normalization factor for the data of a reconstruction.

Dividing the data by it makes a regularization weight independent of the data’s overall scale, and is the normalization BART’s own reconstructions apply before solving.

Parameters:
  • y (torch.Tensor) – Data as the solve will see it: for a Cartesian encoding, after the sampling pattern and fftmod(..., inverse=True). Coils must be on their own axis in BART’s layout rather than the squeezed layout an operator takes, because the estimate is read off the k-space centre and a misplaced coil axis moves it.

  • A (LinearOperator, default=None) – The encoding. With one, the estimate used for a non-Cartesian acquisition: the spread of |A^H y| from its order statistics. Without one, the k-space-centre estimate BART’s estscaling makes, used for a Cartesian acquisition.

  • percentile (float, default=None) – Take this percentile of the sorted magnitudes instead of BART’s rule.

  • compat (bool, default=False) – Take the median, as BART’s older estimate did. Only with A.

Returns:

The scaling. Zero means the estimate failed, and a scaling of one should be used instead.

Return type:

float

Notes

Without A the estimate is BART’s estimate_scaling: the root-sum-of-squares image of the fully sampled central region of k-space, at most 32 samples along each axis, corrected for the region’s size, and the 90th percentile of its voxel magnitudes – or their maximum, when the maximum exceeds the 90th percentile by at least twice the difference between the 90th percentile and the median. With A the same rule is applied to the magnitudes of A^H y.

The solution of a solve on scaled data is scaled by the same factor, and is conventionally left so rather than divided back.

Examples

>>> y = bartorch.fftmod(kspace * pattern, axes=(-1, -2, -3), inverse=True)
>>> scale = optim.data_scaling(y)
>>> x = optim.FISTA(priors.Wavelet((-1, -2), 0.01))((y / scale).squeeze(1), A)

Examples using data_scaling#

Regularized reconstruction

Regularized reconstruction

Operators and solvers

Operators and solvers

Radial SENSE reconstruction

Radial SENSE reconstruction

Dynamic golden-angle radial MRI

Dynamic golden-angle radial MRI

Subspace-constrained T1 mapping

Subspace-constrained T1 mapping

Parameter maps straight from k-space

Parameter maps straight from k-space