Commit 712bfbf3 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

Alignment - Fourier filters: fixed rfft filter shape



The filter shape is computed according to scipy.fft.rfftn recommendations
Signed-off-by: Nicola Vigano's avatarNicola VIGANÒ <nicola.vigano@esrf.fr>
parent 4162b048
Pipeline #28184 passed with stages
in 3 minutes and 6 seconds
......@@ -83,8 +83,8 @@ def get_lowpass_filter(img_shape, cutoff_par=None, use_rfft=False, data_type=np.
res = res.astype(data_type)
if use_rfft:
slicelist = tuple(slice(0, (N + 1) // 2) for N in res.shape)
return res[slicelist]
slicelist = [slice(None)] * (len(res.shape) - 1) + [slice(0, res.shape[-1] // 2 + 1)]
return res[tuple(slicelist)]
else:
return res
......
......@@ -374,8 +374,8 @@ class AlignmentBase(object):
def _compute_correlation_fft(self, img_1, img_2, padding_mode, axes=(-2, -1), low_pass=None, high_pass=None):
do_circular_conv = padding_mode is None or padding_mode == "wrap"
img_shape = img_2.shape
if not do_circular_conv:
img_shape = img_2.shape
pad_size = np.ceil(np.array(img_shape) / 2).astype(np.int)
pad_array = [(0,)] * len(img_shape)
for a in axes:
......@@ -392,7 +392,7 @@ class AlignmentBase(object):
if low_pass is not None or high_pass is not None:
filt = fourier_filters.get_bandpass_filter(
img_prod.shape[-2:],
img_shape[-2:],
cutoff_lowpass=low_pass,
cutoff_highpass=high_pass,
use_rfft=__have_scipy__,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment