summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Wrappers/Python/ccpi/plugins/regularisers.py14
-rw-r--r--Wrappers/Python/conda-recipe/meta.yaml1
-rw-r--r--Wrappers/Python/wip/demo_compare_RGLTK_TV_denoising.py8
-rw-r--r--Wrappers/Python/wip/demo_simple_RGLTK.py8
4 files changed, 16 insertions, 15 deletions
diff --git a/Wrappers/Python/ccpi/plugins/regularisers.py b/Wrappers/Python/ccpi/plugins/regularisers.py
index 46464a9..29d4397 100644
--- a/Wrappers/Python/ccpi/plugins/regularisers.py
+++ b/Wrappers/Python/ccpi/plugins/regularisers.py
@@ -18,14 +18,14 @@
# limitations under the License.
# This requires CCPi-Regularisation toolbox to be installed
-from ccpi.filters.regularisers import ROF_TV, FGP_TV, SB_TV
+from ccpi.filters import regularisers
from ccpi.filters.cpu_regularisers import TV_ENERGY
from ccpi.framework import DataContainer
from ccpi.optimisation.ops import Operator
import numpy as np
-class _ROF_TV_(Operator):
+class ROF_TV(Operator):
def __init__(self,lambdaReg,iterationsTV,tolerance,time_marchstep,device):
# set parameters
self.lambdaReg = lambdaReg
@@ -43,13 +43,13 @@ class _ROF_TV_(Operator):
'number_of_iterations' :self.iterationsTV ,\
'time_marching_parameter':self.time_marchstep}
- out = ROF_TV(pars['input'],
+ out = regularisers.ROF_TV(pars['input'],
pars['regularization_parameter'],
pars['number_of_iterations'],
pars['time_marching_parameter'], self.device)
return DataContainer(out)
-class _FGP_TV_(Operator):
+class FGP_TV(Operator):
def __init__(self,lambdaReg,iterationsTV,tolerance,methodTV,nonnegativity,printing,device):
# set parameters
self.lambdaReg = lambdaReg
@@ -73,7 +73,7 @@ class _FGP_TV_(Operator):
'nonneg': self.nonnegativity ,\
'printingOut': self.printing}
- out = FGP_TV(pars['input'],
+ out = regularisers.FGP_TV(pars['input'],
pars['regularization_parameter'],
pars['number_of_iterations'],
pars['tolerance_constant'],
@@ -83,7 +83,7 @@ class _FGP_TV_(Operator):
return DataContainer(out)
-class _SB_TV_(Operator):
+class SB_TV(Operator):
def __init__(self,lambdaReg,iterationsTV,tolerance,methodTV,printing,device):
# set parameters
self.lambdaReg = lambdaReg
@@ -105,7 +105,7 @@ class _SB_TV_(Operator):
'methodTV': self.methodTV ,\
'printingOut': self.printing}
- out = SB_TV(pars['input'],
+ out = regularisers.SB_TV(pars['input'],
pars['regularization_parameter'],
pars['number_of_iterations'],
pars['tolerance_constant'],
diff --git a/Wrappers/Python/conda-recipe/meta.yaml b/Wrappers/Python/conda-recipe/meta.yaml
index f97de5e..edec71b 100644
--- a/Wrappers/Python/conda-recipe/meta.yaml
+++ b/Wrappers/Python/conda-recipe/meta.yaml
@@ -19,6 +19,7 @@ requirements:
- numpy
- ccpi-framework
- ccpi-reconstruction
+ - ccpi-regulariser
- matplotlib
about:
diff --git a/Wrappers/Python/wip/demo_compare_RGLTK_TV_denoising.py b/Wrappers/Python/wip/demo_compare_RGLTK_TV_denoising.py
index bb9b89f..19cd86f 100644
--- a/Wrappers/Python/wip/demo_compare_RGLTK_TV_denoising.py
+++ b/Wrappers/Python/wip/demo_compare_RGLTK_TV_denoising.py
@@ -10,7 +10,7 @@ from ccpi.optimisation.algs import FISTA, FBPD, CGLS
from ccpi.optimisation.funcs import Norm2sq, ZeroFun, Norm1, TV2D
from ccpi.optimisation.ops import LinearOperatorMatrix, Identity
-from ccpi.plugins.regularisers import _ROF_TV_, _FGP_TV_, _SB_TV_
+from ccpi.plugins.regularisers import ROF_TV, FGP_TV, SB_TV
# All external imports
import numpy as np
@@ -117,7 +117,7 @@ plt.legend()
plt.show()
#%% FISTA with ROF-TV regularisation
-g_rof = _ROF_TV_(lambdaReg = lam_tv,
+g_rof = ROF_TV(lambdaReg = lam_tv,
iterationsTV=2000,
tolerance=0,
time_marchstep=0.0009,
@@ -136,7 +136,7 @@ plt.show()
print(EnergytotalROF)
#%% FISTA with FGP-TV regularisation
-g_fgp = _FGP_TV_(lambdaReg = lam_tv,
+g_fgp = FGP_TV(lambdaReg = lam_tv,
iterationsTV=5000,
tolerance=0,
methodTV=0,
@@ -157,7 +157,7 @@ plt.show()
print(EnergytotalFGP)
#%% Split-Bregman-TV regularisation
-g_sb = _SB_TV_(lambdaReg = lam_tv,
+g_sb = SB_TV(lambdaReg = lam_tv,
iterationsTV=1000,
tolerance=0,
methodTV=0,
diff --git a/Wrappers/Python/wip/demo_simple_RGLTK.py b/Wrappers/Python/wip/demo_simple_RGLTK.py
index d92799a..5564503 100644
--- a/Wrappers/Python/wip/demo_simple_RGLTK.py
+++ b/Wrappers/Python/wip/demo_simple_RGLTK.py
@@ -8,7 +8,7 @@ from ccpi.framework import ImageData , ImageGeometry, AcquisitionGeometry
from ccpi.optimisation.algs import FISTA, FBPD, CGLS
from ccpi.optimisation.funcs import Norm2sq, Norm1, TV2D
from ccpi.astra.ops import AstraProjectorSimple
-from ccpi.plugins.regularisers import _ROF_TV_, _FGP_TV_, _SB_TV_
+from ccpi.plugins.regularisers import ROF_TV, FGP_TV, SB_TV
# All external imports
import numpy as np
@@ -108,7 +108,7 @@ plt.show()
# Set up the ROF variant of TV from the CCPi Regularisation Toolkit and run
# TV-reconstruction using FISTA
-g_rof = _ROF_TV_(lambdaReg = lamtv,
+g_rof = ROF_TV(lambdaReg = lamtv,
iterationsTV=50,
tolerance=1e-5,
time_marchstep=0.01,
@@ -127,7 +127,7 @@ plt.semilogy(criter_rof)
plt.show()
# Repeat for FGP variant.
-g_fgp = _FGP_TV_(lambdaReg = lamtv,
+g_fgp = FGP_TV(lambdaReg = lamtv,
iterationsTV=50,
tolerance=1e-5,
methodTV=0,
@@ -146,7 +146,7 @@ plt.semilogy(criter_fgp)
plt.show()
# Repeat for SB variant.
-g_sb = _SB_TV_(lambdaReg = lamtv,
+g_sb = SB_TV(lambdaReg = lamtv,
iterationsTV=50,
tolerance=1e-5,
methodTV=0,