diff options
Diffstat (limited to 'Wrappers/Python/demos')
-rw-r--r-- | Wrappers/Python/demos/demo_cpu_inpainters.py | 18 | ||||
-rw-r--r-- | Wrappers/Python/demos/demo_cpu_regularisers.py | 17 | ||||
-rw-r--r-- | Wrappers/Python/demos/demo_gpu_regularisers.py | 16 |
3 files changed, 43 insertions, 8 deletions
diff --git a/Wrappers/Python/demos/demo_cpu_inpainters.py b/Wrappers/Python/demos/demo_cpu_inpainters.py index 9a677c4..348d235 100644 --- a/Wrappers/Python/demos/demo_cpu_inpainters.py +++ b/Wrappers/Python/demos/demo_cpu_inpainters.py @@ -37,12 +37,14 @@ Mask = sino.get('Mask') sino_full = sino_full/np.max(sino_full) #apply mask to sinogram sino_cut = sino_full*(1-Mask) -sino_cut_new = np.zeros((angles_dim,detectors_dim),'float32') +#sino_cut_new = np.zeros((angles_dim,detectors_dim),'float32') #sino_cut_new = sino_cut.copy(order='c') -sino_cut_new[:] = sino_cut[:] -mask = np.zeros((angles_dim,detectors_dim),'uint8') +#sino_cut_new[:] = sino_cut[:] +sino_cut_new = np.ascontiguousarray(sino_cut, dtype=np.float32); +#mask = np.zeros((angles_dim,detectors_dim),'uint8') #mask =Mask.copy(order='c') -mask[:] = Mask[:] +#mask[:] = Mask[:] +mask = np.ascontiguousarray(Mask, dtype=np.uint8); plt.figure(1) plt.subplot(121) @@ -68,11 +70,11 @@ imgplot = plt.imshow(sino_cut_new,cmap="gray") pars = {'algorithm' : NDF_INP, \ 'input' : sino_cut_new,\ 'maskData' : mask,\ - 'regularisation_parameter':1000,\ - 'edge_parameter':0.0,\ + 'regularisation_parameter':5000,\ + 'edge_parameter':0,\ 'number_of_iterations' :1000 ,\ 'time_marching_parameter':0.000075,\ - 'penalty_type':1 + 'penalty_type':0 } start_time = timeit.default_timer() @@ -163,7 +165,7 @@ pars = {'algorithm' : NVM_INP, \ 'input' : sino_cut_new,\ 'maskData' : mask,\ 'SW_increment': 1,\ - 'number_of_iterations' :20 + 'number_of_iterations' :0 } start_time = timeit.default_timer() diff --git a/Wrappers/Python/demos/demo_cpu_regularisers.py b/Wrappers/Python/demos/demo_cpu_regularisers.py index 3567f91..f803870 100644 --- a/Wrappers/Python/demos/demo_cpu_regularisers.py +++ b/Wrappers/Python/demos/demo_cpu_regularisers.py @@ -50,7 +50,24 @@ u_ref = Im + np.random.normal(loc = 0 , u0 = u0.astype('float32') u_ref = u_ref.astype('float32') +# change dims to check that modules work with non-squared images +(N,M) = np.shape(u0) +u_ref2 = np.zeros([N,M-100],dtype='float32') +u_ref2[:,0:M-100] = u_ref[:,0:M-100] +u_ref = u_ref2 +del u_ref2 + +u02 = np.zeros([N,M-100],dtype='float32') +u02[:,0:M-100] = u0[:,0:M-100] +u0 = u02 +del u02 + +Im2 = np.zeros([N,M-100],dtype='float32') +Im2[:,0:M-100] = Im[:,0:M-100] +Im = Im2 +del Im2 +#%% print ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") print ("_______________ROF-TV (2D)_________________") print ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") diff --git a/Wrappers/Python/demos/demo_gpu_regularisers.py b/Wrappers/Python/demos/demo_gpu_regularisers.py index b873700..dfdceee 100644 --- a/Wrappers/Python/demos/demo_gpu_regularisers.py +++ b/Wrappers/Python/demos/demo_gpu_regularisers.py @@ -49,6 +49,22 @@ u_ref = Im + np.random.normal(loc = 0 , u0 = u0.astype('float32') u_ref = u_ref.astype('float32') +(N,M) = np.shape(u0) +u_ref2 = np.zeros([N,M-100],dtype='float32') +u_ref2[:,0:M-100] = u_ref[:,0:M-100] +u_ref = u_ref2 +del u_ref2 + +u02 = np.zeros([N,M-100],dtype='float32') +u02[:,0:M-100] = u0[:,0:M-100] +u0 = u02 +del u02 + +Im2 = np.zeros([N,M-100],dtype='float32') +Im2[:,0:M-100] = Im[:,0:M-100] +Im = Im2 +del Im2 + print ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") print ("____________ROF-TV regulariser_____________") print ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") |