summaryrefslogtreecommitdiffstats
path: root/Wrappers/Python/src
diff options
context:
space:
mode:
authorDaniil Kazantsev <dkazanc3@googlemail.com>2019-02-01 10:12:13 +0000
committerGitHub <noreply@github.com>2019-02-01 10:12:13 +0000
commit55a208da580243361f6f04ed6800da40507f3681 (patch)
treef29dfbd80a8bd8a343c219400672339c20475045 /Wrappers/Python/src
parentd5ae6207e1045af233b9c27f94d78a3e1e8600bd (diff)
parent3660ecf4ce9594edd6b35bd8e3c70e5c6d080ef0 (diff)
downloadregularization-55a208da580243361f6f04ed6800da40507f3681.tar.gz
regularization-55a208da580243361f6f04ed6800da40507f3681.tar.bz2
regularization-55a208da580243361f6f04ed6800da40507f3681.tar.xz
regularization-55a208da580243361f6f04ed6800da40507f3681.zip
Merge pull request #87 from vais-ral/fix_TGV
Fix tgv
Diffstat (limited to 'Wrappers/Python/src')
-rw-r--r--Wrappers/Python/src/cpu_regularisers.pyx10
-rw-r--r--Wrappers/Python/src/gpu_regularisers.pyx7
2 files changed, 14 insertions, 3 deletions
diff --git a/Wrappers/Python/src/cpu_regularisers.pyx b/Wrappers/Python/src/cpu_regularisers.pyx
index 4aa3251..7d57ed1 100644
--- a/Wrappers/Python/src/cpu_regularisers.pyx
+++ b/Wrappers/Python/src/cpu_regularisers.pyx
@@ -199,9 +199,15 @@ def TV_SB_3D(np.ndarray[np.float32_t, ndim=3, mode="c"] inputData,
#***************************************************************#
def TGV_CPU(inputData, regularisation_parameter, alpha1, alpha0, iterations, LipshitzConst):
if inputData.ndim == 2:
- return TGV_2D(inputData, regularisation_parameter, alpha1, alpha0, iterations, LipshitzConst)
+ return TGV_2D(inputData, regularisation_parameter, alpha1, alpha0,
+ iterations, LipshitzConst)
elif inputData.ndim == 3:
- return 0
+ shape = inputData.shape
+ out = inputData.copy()
+ for i in range(shape[0]):
+ out[i,:,:] = TGV_2D(inputData[i,:,:], regularisation_parameter,
+ alpha1, alpha0, iterations, LipshitzConst)
+ return out
def TGV_2D(np.ndarray[np.float32_t, ndim=2, mode="c"] inputData,
float regularisation_parameter,
diff --git a/Wrappers/Python/src/gpu_regularisers.pyx b/Wrappers/Python/src/gpu_regularisers.pyx
index 2b97865..47a6149 100644
--- a/Wrappers/Python/src/gpu_regularisers.pyx
+++ b/Wrappers/Python/src/gpu_regularisers.pyx
@@ -102,7 +102,12 @@ def TGV_GPU(inputData, regularisation_parameter, alpha1, alpha0, iterations, Lip
if inputData.ndim == 2:
return TGV2D(inputData, regularisation_parameter, alpha1, alpha0, iterations, LipshitzConst)
elif inputData.ndim == 3:
- return 0
+ shape = inputData.shape
+ out = inputData.copy()
+ for i in range(shape[0]):
+ out[i,:,:] = TGV2D(inputData[i,:,:], regularisation_parameter,
+ alpha1, alpha0, iterations, LipshitzConst)
+ return out
# Directional Total-variation Fast-Gradient-Projection (FGP)
def dTV_FGP_GPU(inputData,
refdata,