summaryrefslogtreecommitdiffstats
path: root/Wrappers/Python/ccpi
diff options
context:
space:
mode:
authoralgol <dkazanc@hotmail.com>2018-03-06 16:18:20 +0000
committeralgol <dkazanc@hotmail.com>2018-03-06 16:18:20 +0000
commit63ad8306c261a90c572d95084bf1dd8db2b3dce7 (patch)
tree8069f7f7bf5e454634dec8b757b02284a378de13 /Wrappers/Python/ccpi
parent5411ebbd4165c81b398b010d6ad9d11d2e973aad (diff)
downloadregularization-63ad8306c261a90c572d95084bf1dd8db2b3dce7.tar.gz
regularization-63ad8306c261a90c572d95084bf1dd8db2b3dce7.tar.bz2
regularization-63ad8306c261a90c572d95084bf1dd8db2b3dce7.tar.xz
regularization-63ad8306c261a90c572d95084bf1dd8db2b3dce7.zip
FGP/ROF-CPU/GPU fully working with new interfaces and regularizers.py script. This closes #39 and #38
Diffstat (limited to 'Wrappers/Python/ccpi')
-rw-r--r--Wrappers/Python/ccpi/filters/regularizers.py44
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