From 97d2cbf43f301b2d002fc109978f9fc8a8fd5bdf Mon Sep 17 00:00:00 2001 From: Edoardo Pasca Date: Tue, 23 Jan 2018 22:24:37 +0000 Subject: Fix #13 Fixes #13. Bug due to calling list(np::array). For some reasons, it splitted the array (512x512) in 512 arrays of len 512. --- Wrappers/Python/ccpi/filters/Regularizer.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'Wrappers/Python/ccpi') diff --git a/Wrappers/Python/ccpi/filters/Regularizer.py b/Wrappers/Python/ccpi/filters/Regularizer.py index 8623f41..b9f12ca 100644 --- a/Wrappers/Python/ccpi/filters/Regularizer.py +++ b/Wrappers/Python/ccpi/filters/Regularizer.py @@ -251,7 +251,9 @@ class Regularizer(): def SplitBregman_TV(input, regularization_parameter , **kwargs): start_time = timeit.default_timer() reg = Regularizer(Regularizer.Algorithm.SplitBregman_TV) - out = list( reg(input, regularization_parameter, **kwargs) ) + out = [] + a = reg(input, regularization_parameter, **kwargs) + out.append(a) out.append(reg.pars) txt = reg.printParametersToString() txt += "%s = %.3fs" % ('elapsed time',timeit.default_timer() - start_time) @@ -262,7 +264,9 @@ class Regularizer(): def FGP_TV(input, regularization_parameter , **kwargs): start_time = timeit.default_timer() reg = Regularizer(Regularizer.Algorithm.FGP_TV) - out = list( reg(input, regularization_parameter, **kwargs) ) + out = [] + a = reg(input, regularization_parameter, **kwargs) + out.append(a) out.append(reg.pars) txt = reg.printParametersToString() txt += "%s = %.3fs" % ('elapsed time',timeit.default_timer() - start_time) @@ -274,10 +278,13 @@ class Regularizer(): tolerance_constant, restrictive_Z_smoothing=0): start_time = timeit.default_timer() reg = Regularizer(Regularizer.Algorithm.LLT_model) - out = list( reg(input, regularization_parameter, time_step=time_step, + out = [] + a = reg(input, regularization_parameter, time_step=time_step, number_of_iterations=number_of_iterations, tolerance_constant=tolerance_constant, - restrictive_Z_smoothing=restrictive_Z_smoothing) ) + restrictive_Z_smoothing=restrictive_Z_smoothing) + + out.append(a) out.append(reg.pars) txt = reg.printParametersToString() txt += "%s = %.3fs" % ('elapsed time',timeit.default_timer() - start_time) @@ -291,12 +298,13 @@ class Regularizer(): PB_filtering_parameter): start_time = timeit.default_timer() reg = Regularizer(Regularizer.Algorithm.PatchBased_Regul) - out = list( reg(input, + out = [] + a = reg(input, regularization_parameter, searching_window_ratio=searching_window_ratio, similarity_window_ratio=similarity_window_ratio, PB_filtering_parameter=PB_filtering_parameter ) - ) + out.append(a) out.append(reg.pars) txt = reg.printParametersToString() txt += "%s = %.3fs" % ('elapsed time',timeit.default_timer() - start_time) @@ -309,10 +317,12 @@ class Regularizer(): start_time = timeit.default_timer() reg = Regularizer(Regularizer.Algorithm.TGV_PD) - out = list( reg(input, regularization_parameter, + a = reg(input, regularization_parameter, first_order_term=first_order_term, second_order_term=second_order_term, - number_of_iterations=number_of_iterations) ) + number_of_iterations=number_of_iterations) + out = [] + out.append(a) out.append(reg.pars) txt = reg.printParametersToString() txt += "%s = %.3fs" % ('elapsed time',timeit.default_timer() - start_time) -- cgit v1.2.3