diff options
author | Daniil Kazantsev <dkazanc3@googlemail.com> | 2018-05-12 23:00:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-12 23:00:39 +0100 |
commit | 6e028f10427459b4ce8975cd5e6b85d761dba8b8 (patch) | |
tree | 0f13de94c84b3957ac7fad520e9c4afb3415c889 | |
parent | 0f8b7377c059911112bf360ce137f0e444e0bb50 (diff) | |
parent | 9effaa8a0e2b3effae795605720c800ba72c5410 (diff) | |
download | framework-plugins-6e028f10427459b4ce8975cd5e6b85d761dba8b8.tar.gz framework-plugins-6e028f10427459b4ce8975cd5e6b85d761dba8b8.tar.bz2 framework-plugins-6e028f10427459b4ce8975cd5e6b85d761dba8b8.tar.xz framework-plugins-6e028f10427459b4ce8975cd5e6b85d761dba8b8.zip |
Merge pull request #12 from vais-ral/RGL_demo_add_SB
Actually add SB to RGL simple demo
-rw-r--r-- | Wrappers/Python/wip/demo_compare_RGLTK_TV_denoising.py | 2 | ||||
-rw-r--r-- | Wrappers/Python/wip/demo_simple_RGLTK.py | 28 |
2 files changed, 27 insertions, 3 deletions
diff --git a/Wrappers/Python/wip/demo_compare_RGLTK_TV_denoising.py b/Wrappers/Python/wip/demo_compare_RGLTK_TV_denoising.py index 911cff4..bb9b89f 100644 --- a/Wrappers/Python/wip/demo_compare_RGLTK_TV_denoising.py +++ b/Wrappers/Python/wip/demo_compare_RGLTK_TV_denoising.py @@ -171,7 +171,7 @@ xtv_sb = g_sb.prox(y,1.0) print("CCPi-RGL TV SB:") plt.figure() plt.imshow(xtv_sb.as_array()) -EnergytotalSB = f_denoise(xtv_sb) + g_fgp(xtv_sb) +EnergytotalSB = f_denoise(xtv_sb) + g_sb(xtv_sb) plt.title('SB TV prox with objective equal to {:.2f}'.format(EnergytotalSB)) plt.show() print(EnergytotalSB) 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() |