mrpro.utils.filters.filter_separable

mrpro.utils.filters.filter_separable(x: Tensor, kernels: Sequence[Tensor], dim: Sequence[int], pad_mode: Literal['constant', 'reflect', 'replicate', 'circular', 'none'] = 'constant', pad_value: float = 0.0) → Tensor

Apply the separable filter kernels to the tensor x along the axes dim.

Does padding to keep the output the same size as the input.

Parameters:
  • x (Tensor) – Tensor to filter

  • kernels (Sequence[Tensor]) – List of 1D kernels to apply to the tensor x

  • dim (Sequence[int]) – Axes to filter over. Must have the same length as kernels.

  • pad_mode (Literal['constant', 'reflect', 'replicate', 'circular', 'none'], default: 'constant') – Padding mode

  • pad_value (float, default: 0.0) – Padding value for pad_mode = constant

Returns:

  • The filtered tensor, with the same shape as the input unless pad_mode is ‘none’ and and promoted dtype of the input

  • and the kernels.