summaryrefslogtreecommitdiffstats
path: root/Wrappers/Python/ccpi
diff options
context:
space:
mode:
authorDaniil Kazantsev <dkazanc@hotmail.com>2018-05-11 12:44:18 +0100
committerDaniil Kazantsev <dkazanc@hotmail.com>2018-05-11 12:44:18 +0100
commit0dd1cadcfead9a2a5f225e1500c97cc00a8068d6 (patch)
tree7026566f4b7ec41d5039608f53bc734d2763a540 /Wrappers/Python/ccpi
parent4f0fc6601200aadab9502b602000dc6b74539c6b (diff)
downloadframework-plugins-0dd1cadcfead9a2a5f225e1500c97cc00a8068d6.tar.gz
framework-plugins-0dd1cadcfead9a2a5f225e1500c97cc00a8068d6.tar.bz2
framework-plugins-0dd1cadcfead9a2a5f225e1500c97cc00a8068d6.tar.xz
framework-plugins-0dd1cadcfead9a2a5f225e1500c97cc00a8068d6.zip
some fixes regarding denoising
Diffstat (limited to 'Wrappers/Python/ccpi')
-rw-r--r--Wrappers/Python/ccpi/plugins/regularisers.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/Wrappers/Python/ccpi/plugins/regularisers.py b/Wrappers/Python/ccpi/plugins/regularisers.py
index e9c88a4..6d865cc 100644
--- a/Wrappers/Python/ccpi/plugins/regularisers.py
+++ b/Wrappers/Python/ccpi/plugins/regularisers.py
@@ -25,7 +25,6 @@ from ccpi.optimisation.ops import Operator
import numpy as np
-
class _ROF_TV_(Operator):
def __init__(self,lambdaReg,iterationsTV,tolerance,time_marchstep,device):
# set parameters
@@ -33,9 +32,10 @@ class _ROF_TV_(Operator):
self.iterationsTV = iterationsTV
self.time_marchstep = time_marchstep
self.device = device # string for 'cpu' or 'gpu'
- def __call__(self,x):
+ def __call__(self,x,x1,typeEnergy):
# evaluate objective function of TV gradient
- EnergyValTV = TV_ENERGY(np.asarray(x.as_array(), dtype=np.float32), np.asarray(x.as_array(), dtype=np.float32), self.lambdaReg, 2)
+ # typeEnergy is either 1 (LS + TV for denoising) or 2 (just TV fidelity)
+ EnergyValTV = TV_ENERGY(np.asarray(x.as_array(), dtype=np.float32), np.asarray(x1.as_array(), dtype=np.float32), self.lambdaReg, typeEnergy)
return EnergyValTV
def prox(self,x,Lipshitz):
pars = {'algorithm' : ROF_TV, \
@@ -60,9 +60,10 @@ class _FGP_TV_(Operator):
self.nonnegativity = nonnegativity
self.printing = printing
self.device = device # string for 'cpu' or 'gpu'
- def __call__(self,x):
+ def __call__(self,x,x1,typeEnergy):
# evaluate objective function of TV gradient
- EnergyValTV = TV_ENERGY(np.asarray(x.as_array(), dtype=np.float32), np.asarray(x.as_array(), dtype=np.float32), self.lambdaReg, 2)
+ # typeEnergy is either 1 (LS + TV for denoising) or 2 (just TV fidelity)
+ EnergyValTV = TV_ENERGY(np.asarray(x.as_array(), dtype=np.float32), np.asarray(x1.as_array(), dtype=np.float32), self.lambdaReg, typeEnergy)
return EnergyValTV
def prox(self,x,Lipshitz):
pars = {'algorithm' : FGP_TV, \
@@ -93,9 +94,10 @@ class _SB_TV_(Operator):
self.methodTV = methodTV
self.printing = printing
self.device = device # string for 'cpu' or 'gpu'
- def __call__(self,x):
+ def __call__(self,x,typeEnergy):
# evaluate objective function of TV gradient
- EnergyValTV = TV_ENERGY(np.asarray(x.as_array(), dtype=np.float32), np.asarray(x.as_array(), dtype=np.float32), self.lambdaReg, 2)
+ # typeEnergy is either 1 (LS + TV for denoising) or 2 (just TV fidelity)
+ EnergyValTV = TV_ENERGY(np.asarray(x.as_array(), dtype=np.float32), np.asarray(x.as_array(), dtype=np.float32), self.lambdaReg, typeEnergy)
return EnergyValTV
def prox(self,x,Lipshitz):
pars = {'algorithm' : SB_TV, \