priors.nlmeans#
- bartorch.priors.nlmeans()#
Non-local means filter along
axes, BART’snlmeans.Each voxel becomes \(\sum_j w_{ij} y_j / \sum_j w_{ij}\) over the voxels \(j\) within
patch_distanceof it along every axis ofaxes, with\[w_{ij} = \exp\Bigl( -\frac{\sum_o g_o |y_{i+o} - y_{j+o}|^2}{2 h^2 \|g\|_2} \Bigr),\]where \(o\) runs over a patch of
patch_lengthper axis and \(g\) is a Gaussian of standard deviationaover it. The image is reflected at its edges.- Parameters:
input (torch.Tensor) – Image \(y\).
axes (int or tuple of int) – Axes the patches and the search span.
patch_length (int, default=None) – Odd patch length per axis; BART’s 5 when omitted.
patch_distance (int, default=None) – Search radius per axis; BART’s 5 when omitted. Zero returns
input.h (float, default=None) – Filter strength, in the units of
input’s values; BART’s 0.04 when omitted. A largehmakes the filter a box mean.a (float, default=None) – Standard deviation of \(g\), in voxels;
(patch_length - 1) / 4when omitted.
- Returns:
Filtered image, of
input’s shape.- Return type:
torch.Tensor
- Raises:
ValueError – An even
patch_length.