Fix filtering with mode "reflect"
About
Fix sinogram FFT filtering when mode is "reflect".
Close #453 (closed)
To do
-
Fix filtering when mode is "reflect" -
Unit tests -
Update changelog/documentation
Notes
The reference function filter_sinogram()
does a padding in the form (0, L+R)
, while SinoFilter
pads with (L, R)
.
This is not equivalent in general, except for mode="constant"
(zero-padding).
Consider the simple case data = [0, 1, 2, 3, 4]
, padded on the left with L = 3
values and on the right with R = 4
values.
============================== edge ==============================
Coordinates [L|data|R]
[0 0 0 0 1 2 3 4 4 4 4 4]
Periodization of [L|data|R]
[0 0 0 0 1 2 3 4 4 4 4 4 0 0 0 0 1 2 3 4 4 4 4 4 0 0 0 0 1 2 3 4 4 4 4 4]
Coordinates [data|L+R]
[0 1 2 3 4 4 4 4 4 4 4 4]
Periodization of [data|L+R]
[0 1 2 3 4 4 4 4 4 4 4 4 0 1 2 3 4 4 4 4 4 4 4 4 0 1 2 3 4 4 4 4 4 4 4 4]
============================== reflect ==============================
Coordinates [L|data|R]
[3 2 1 0 1 2 3 4 3 2 1 0]
Periodization of [L|data|R]
[3 2 1 0 1 2 3 4 3 2 1 0 3 2 1 0 1 2 3 4 3 2 1 0 3 2 1 0 1 2 3 4 3 2 1 0]
Coordinates [data|L+R]
[0 1 2 3 4 3 2 1 0 1 2 3]
Periodization of [data|L+R]
[0 1 2 3 4 3 2 1 0 1 2 3 0 1 2 3 4 3 2 1 0 1 2 3 0 1 2 3 4 3 2 1 0 1 2 3]
============================== wrap ==============================
Coordinates [L|data|R]
[2 3 4 0 1 2 3 4 0 1 2 3]
Periodization of [L|data|R]
[2 3 4 0 1 2 3 4 0 1 2 3 2 3 4 0 1 2 3 4 0 1 2 3 2 3 4 0 1 2 3 4 0 1 2 3]
Coordinates [data|L+R]
[0 1 2 3 4 0 1 2 3 4 0 1]
Periodization of [data|L+R]
[0 1 2 3 4 0 1 2 3 4 0 1 0 1 2 3 4 0 1 2 3 4 0 1 0 1 2 3 4 0 1 2 3 4 0 1]
============================== symmetric ==============================
Coordinates [L|data|R]
[2 1 0 0 1 2 3 4 4 3 2 1]
Periodization of [L|data|R]
[2 1 0 0 1 2 3 4 4 3 2 1 2 1 0 0 1 2 3 4 4 3 2 1 2 1 0 0 1 2 3 4 4 3 2 1]
Coordinates [data|L+R]
[0 1 2 3 4 4 3 2 1 0 0 1]
Periodization of [data|L+R]
[0 1 2 3 4 4 3 2 1 0 0 1 0 1 2 3 4 4 3 2 1 0 0 1 0 1 2 3 4 4 3 2 1 0 0 1]
The test pass because the sinogram used for tests nicely goes to zero at the edges.
Therefore, in the tests, the left part equals the right part (= 0), except when mode is "reflect".
Using a truncated sinogram (as in local tomography), the tests fail also for mode="edge"
.
(they still pass for mode="wrap"
because [L|data|R] = [data|L+R]
in this case).
Edited by Pierre Paleo