diff options
author | dkazanc <dkazanc@hotmail.com> | 2018-03-07 10:26:56 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-07 10:26:56 +0000 |
commit | 3ed9b4129cdab5110e67a4705b3bd52fd9781f8b (patch) | |
tree | 2c158b86dff89d8b7f5622cbdce8d5600eaaab5e /Wrappers/Python/ccpi | |
parent | b8e4e8d89432cfaa860835d873b52e4df40d92d5 (diff) | |
parent | fbb7a12f7714978c251f02bf84ab9a66c762f428 (diff) | |
download | regularization-3ed9b4129cdab5110e67a4705b3bd52fd9781f8b.tar.gz regularization-3ed9b4129cdab5110e67a4705b3bd52fd9781f8b.tar.bz2 regularization-3ed9b4129cdab5110e67a4705b3bd52fd9781f8b.tar.xz regularization-3ed9b4129cdab5110e67a4705b3bd52fd9781f8b.zip |
Merge pull request #40 from vais-ral/GPU_test
ROF/FGP updated via Cython
Diffstat (limited to 'Wrappers/Python/ccpi')
-rw-r--r-- | Wrappers/Python/ccpi/filters/regularizers.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Wrappers/Python/ccpi/filters/regularizers.py b/Wrappers/Python/ccpi/filters/regularizers.py new file mode 100644 index 0000000..d6dfa8c --- /dev/null +++ b/Wrappers/Python/ccpi/filters/regularizers.py @@ -0,0 +1,44 @@ +""" +script which assigns a proper device core function based on a flag ('cpu' or 'gpu') +""" + +from ccpi.filters.cpu_regularizers_cython import TV_ROF_CPU, TV_FGP_CPU +from ccpi.filters.gpu_regularizers import TV_ROF_GPU, TV_FGP_GPU + +def ROF_TV(inputData, regularization_parameter, iterations, + time_marching_parameter,device='cpu'): + if device == 'cpu': + return TV_ROF_CPU(inputData, + regularization_parameter, + iterations, + time_marching_parameter) + elif device == 'gpu': + return TV_ROF_GPU(inputData, + regularization_parameter, + iterations, + time_marching_parameter) + else: + raise ValueError('Unknown device {0}. Expecting gpu or cpu'\ + .format(device)) + +def FGP_TV(inputData, regularization_parameter,iterations, + tolerance_param, methodTV, nonneg, printM, device='cpu'): + if device == 'cpu': + return TV_FGP_CPU(inputData, + regularization_parameter, + iterations, + tolerance_param, + methodTV, + nonneg, + printM) + elif device == 'gpu': + return TV_FGP_GPU(inputData, + regularization_parameter, + iterations, + tolerance_param, + methodTV, + nonneg, + printM) + else: + raise ValueError('Unknown device {0}. Expecting gpu or cpu'\ + .format(device))
\ No newline at end of file |