summaryrefslogtreecommitdiffstats
path: root/src/Python
diff options
context:
space:
mode:
authordkazanc <dkazanc@hotmail.com>2019-11-26 14:51:34 +0000
committerdkazanc <dkazanc@hotmail.com>2019-11-26 14:51:34 +0000
commit494a857b830fce5e786dfc058f68bf78d9673ba6 (patch)
treee2f2156457848c6cd8ba4fc28c4ad5eac7fd893d /src/Python
parent5e7b28053dfe06008657bcdb68462dc3d84b8a22 (diff)
downloadregularization-494a857b830fce5e786dfc058f68bf78d9673ba6.tar.gz
regularization-494a857b830fce5e786dfc058f68bf78d9673ba6.tar.bz2
regularization-494a857b830fce5e786dfc058f68bf78d9673ba6.tar.xz
regularization-494a857b830fce5e786dfc058f68bf78d9673ba6.zip
PDTV 3D verision
Diffstat (limited to 'src/Python')
-rw-r--r--src/Python/setup-regularisers.py.in1
-rw-r--r--src/Python/src/cpu_regularisers.pyx29
2 files changed, 28 insertions, 2 deletions
diff --git a/src/Python/setup-regularisers.py.in b/src/Python/setup-regularisers.py.in
index 9bcd46d..9a5b693 100644
--- a/src/Python/setup-regularisers.py.in
+++ b/src/Python/setup-regularisers.py.in
@@ -38,7 +38,6 @@ extra_include_dirs += [os.path.join(".." , "Core"),
os.path.join(".." , "Core", "regularisers_CPU"),
os.path.join(".." , "Core", "inpainters_CPU"),
os.path.join(".." , "Core", "regularisers_GPU" , "TV_FGP" ) ,
- os.path.join(".." , "Core", "regularisers_GPU" , "TV_PD" ) ,
os.path.join(".." , "Core", "regularisers_GPU" , "TV_ROF" ) ,
os.path.join(".." , "Core", "regularisers_GPU" , "TV_SB" ) ,
os.path.join(".." , "Core", "regularisers_GPU" , "TGV" ) ,
diff --git a/src/Python/src/cpu_regularisers.pyx b/src/Python/src/cpu_regularisers.pyx
index 724634b..08e247c 100644
--- a/src/Python/src/cpu_regularisers.pyx
+++ b/src/Python/src/cpu_regularisers.pyx
@@ -163,7 +163,7 @@ def TV_PD_CPU(inputData, regularisation_parameter, iterationsNumb, tolerance_par
if inputData.ndim == 2:
return TV_PD_2D(inputData, regularisation_parameter, iterationsNumb, tolerance_param, methodTV, nonneg, lipschitz_const)
elif inputData.ndim == 3:
- return 0
+ return TV_PD_3D(inputData, regularisation_parameter, iterationsNumb, tolerance_param, methodTV, nonneg, lipschitz_const)
def TV_PD_2D(np.ndarray[np.float32_t, ndim=2, mode="c"] inputData,
float regularisation_parameter,
@@ -191,7 +191,34 @@ def TV_PD_2D(np.ndarray[np.float32_t, ndim=2, mode="c"] inputData,
methodTV,
nonneg,
dims[1],dims[0], 1)
+ return (outputData,infovec)
+
+def TV_PD_3D(np.ndarray[np.float32_t, ndim=3, mode="c"] inputData,
+ float regularisation_parameter,
+ int iterationsNumb,
+ float tolerance_param,
+ int methodTV,
+ int nonneg,
+ float lipschitz_const):
+
+ cdef long dims[3]
+ dims[0] = inputData.shape[0]
+ dims[1] = inputData.shape[1]
+ dims[2] = inputData.shape[2]
+ cdef np.ndarray[np.float32_t, ndim=3, mode="c"] outputData = \
+ np.zeros([dims[0], dims[1], dims[2]], dtype='float32')
+ cdef np.ndarray[np.float32_t, ndim=1, mode="c"] infovec = \
+ np.zeros([2], dtype='float32')
+
+ #/* Run FGP-TV iterations for 3D data */
+ PDTV_CPU_main(&inputData[0,0,0], &outputData[0,0,0], &infovec[0], regularisation_parameter,
+ iterationsNumb,
+ tolerance_param,
+ lipschitz_const,
+ methodTV,
+ nonneg,
+ dims[2], dims[1], dims[0])
return (outputData,infovec)
#***************************************************************#