summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Jorgensen, WS at HMXIF <jakob.jorgensen@manchester.ac.uk>2018-05-12 22:21:48 +0100
committerJakob Jorgensen, WS at HMXIF <jakob.jorgensen@manchester.ac.uk>2018-05-12 22:21:48 +0100
commit64a649d69840b66e39f00ba47e6ac86dbc9d749b (patch)
treeaae445f68dd6129507eb50a9cdbba76497f173c5
parent0f8b7377c059911112bf360ce137f0e444e0bb50 (diff)
downloadframework-plugins-64a649d69840b66e39f00ba47e6ac86dbc9d749b.tar.gz
framework-plugins-64a649d69840b66e39f00ba47e6ac86dbc9d749b.tar.bz2
framework-plugins-64a649d69840b66e39f00ba47e6ac86dbc9d749b.tar.xz
framework-plugins-64a649d69840b66e39f00ba47e6ac86dbc9d749b.zip
Actually add SB to RGL simple demo
-rw-r--r--Wrappers/Python/wip/demo_simple_RGLTK.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/Wrappers/Python/wip/demo_simple_RGLTK.py b/Wrappers/Python/wip/demo_simple_RGLTK.py
index dbd2a55..d92799a 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_
+from ccpi.plugins.regularisers import _ROF_TV_, _FGP_TV_, _SB_TV_
# All external imports
import numpy as np
@@ -145,9 +145,27 @@ plt.subplot(122)
plt.semilogy(criter_fgp)
plt.show()
+# Repeat for SB variant.
+g_sb = _SB_TV_(lambdaReg = lamtv,
+ iterationsTV=50,
+ tolerance=1e-5,
+ methodTV=0,
+ printing=0,
+ device='cpu')
+
+x_fista_sb, it1, timing1, criter_sb = FISTA(x_init, f, g_sb,opt)
+
+plt.figure()
+plt.subplot(121)
+plt.imshow(x_fista_sb.array)
+plt.title('FISTA SB TV')
+plt.subplot(122)
+plt.semilogy(criter_sb)
+plt.show()
+
# Compare all reconstruction and criteria
clims = (0,1)
-cols = 3
+cols = 4
rows = 1
current = 1
fig = plt.figure()
@@ -166,6 +184,11 @@ a=fig.add_subplot(rows,cols,current)
a.set_title('FISTA FGP TV')
imgplot = plt.imshow(x_fista_fgp.as_array(),vmin=clims[0],vmax=clims[1])
+current = current + 1
+a=fig.add_subplot(rows,cols,current)
+a.set_title('FISTA SB TV')
+imgplot = plt.imshow(x_fista_sb.as_array(),vmin=clims[0],vmax=clims[1])
+
fig = plt.figure()
b=fig.add_subplot(1,1,1)
@@ -173,5 +196,6 @@ b.set_title('criteria')
imgplot = plt.loglog(criter_fbpdtv , label='FBPD TV')
imgplot = plt.loglog(criter_rof , label='ROF TV')
imgplot = plt.loglog(criter_fgp, label='FGP TV')
+imgplot = plt.loglog(criter_sb, label='SB TV')
b.legend(loc='right')
plt.show()