diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2019-05-10 15:23:52 +0100 |
---|---|---|
committer | Edoardo Pasca <edo.paskino@gmail.com> | 2019-05-10 15:23:52 +0100 |
commit | 24665dc2b0d981aad97aed618070c4ffca0add6c (patch) | |
tree | e932c4a43194fef1dac55bfb958fc910d3251397 /Wrappers/Python | |
parent | c43ec42bb8a140ca4de7b43e9967263fb23099bd (diff) | |
download | framework-24665dc2b0d981aad97aed618070c4ffca0add6c.tar.gz framework-24665dc2b0d981aad97aed618070c4ffca0add6c.tar.bz2 framework-24665dc2b0d981aad97aed618070c4ffca0add6c.tar.xz framework-24665dc2b0d981aad97aed618070c4ffca0add6c.zip |
added info on how to change image
Diffstat (limited to 'Wrappers/Python')
-rw-r--r-- | Wrappers/Python/demos/PDHG_examples/PDHG_TV_Denoising_Gaussian.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Wrappers/Python/demos/PDHG_examples/PDHG_TV_Denoising_Gaussian.py b/Wrappers/Python/demos/PDHG_examples/PDHG_TV_Denoising_Gaussian.py index 610cb2c..cba5bcb 100644 --- a/Wrappers/Python/demos/PDHG_examples/PDHG_TV_Denoising_Gaussian.py +++ b/Wrappers/Python/demos/PDHG_examples/PDHG_TV_Denoising_Gaussian.py @@ -57,13 +57,16 @@ loader = TestData(data_dir=os.path.join(sys.prefix, 'share','ccpi')) N = 256 M = 300 -data = np.zeros((N,N)) -data[round(N/4):round(3*N/4),round(N/4):round(3*N/4)] = 0.5 -data[round(N/8):round(7*N/8),round(3*N/8):round(5*N/8)] = 1 -data = ImageData(data) + +# user can change the size of the input data +# you can choose between +# TestData.PEPPERS 2D + Channel +# TestData.BOAT 2D +# TestData.CAMERA 2D +# TestData.RESOLUTION_CHART 2D +# TestData.SIMPLE_PHANTOM_2D 2D data = loader.load(TestData.PEPPERS, size=(N,M), scale=(0,1)) -#ig = ImageGeometry(voxel_num_x = N, voxel_num_y = N) -print (data) + ig = data.geometry ag = ig @@ -129,7 +132,7 @@ tau = 1/(sigma*normK**2) pdhg = PDHG(f=f,g=g,operator=operator, tau=tau, sigma=sigma) pdhg.max_iteration = 10000 pdhg.update_objective_interval = 100 -pdhg.run(200, verbose=True) +pdhg.run(1000, verbose=True) # Show Results plt.figure() @@ -150,9 +153,10 @@ plt.clim(0,1) plt.colorbar() plt.show() +plt.plot(np.linspace(0,N,M), noisy_data.as_array()[int(N/2),:], label = 'Noisy data') plt.plot(np.linspace(0,N,M), data.as_array()[int(N/2),:], label = 'GTruth') plt.plot(np.linspace(0,N,M), pdhg.get_output().as_array()[int(N/2),:], label = 'TV reconstruction') -plt.plot(np.linspace(0,N,M), noisy_data.as_array()[int(N/2),:], label = 'Noisy data') + plt.legend() plt.title('Middle Line Profiles') plt.show() |