|
1 | 1 | #!/usr/bin/env python3
|
2 | 2 | # -*- coding: utf-8 -*-
|
| 3 | +#%% |
3 | 4 | """
|
4 | 5 | Created on Thu Feb 22 11:39:43 2018
|
5 | 6 |
|
@@ -30,6 +31,7 @@ def printParametersToString(pars):
|
30 | 31 | return txt
|
31 | 32 | ###############################################################################
|
32 | 33 |
|
| 34 | +os.chdir(os.path.join("..", "demos")) |
33 | 35 | filename = os.path.join( "data" ,"lena_gray_512.tif")
|
34 | 36 |
|
35 | 37 | # read image
|
@@ -101,11 +103,12 @@ def printParametersToString(pars):
|
101 | 103 |
|
102 | 104 | print ("#############ROF TV CPU####################")
|
103 | 105 | start_time = timeit.default_timer()
|
104 |
| -(rof_cpu3D, info_vec_cpu) = ROF_TV(pars['input'], |
| 106 | +info_vec_cpu = np.zeros(2, dtype = np.float32) |
| 107 | +rof_cpu3D = ROF_TV(pars['input'], |
105 | 108 | pars['regularisation_parameter'],
|
106 | 109 | pars['number_of_iterations'],
|
107 | 110 | pars['time_marching_parameter'],
|
108 |
| - pars['tolerance_constant'], 'cpu') |
| 111 | + pars['tolerance_constant'], device='cpu', infovector=info_vec_cpu) |
109 | 112 |
|
110 | 113 | Qtools = QualityTools(idealVol, rof_cpu3D)
|
111 | 114 | pars['rmse'] = Qtools.rmse()
|
@@ -146,12 +149,12 @@ def printParametersToString(pars):
|
146 | 149 |
|
147 | 150 | print ("#############FGP TV GPU####################")
|
148 | 151 | start_time = timeit.default_timer()
|
149 |
| -(fgp_cpu3D, info_vec_cpu) = FGP_TV(pars['input'], |
| 152 | +fgp_cpu3D = FGP_TV(pars['input'], |
150 | 153 | pars['regularisation_parameter'],
|
151 | 154 | pars['number_of_iterations'],
|
152 | 155 | pars['tolerance_constant'],
|
153 | 156 | pars['methodTV'],
|
154 |
| - pars['nonneg'], 'cpu') |
| 157 | + pars['nonneg'], device='cpu', infovector=info_vec_cpu) |
155 | 158 |
|
156 | 159 | Qtools = QualityTools(idealVol, fgp_cpu3D)
|
157 | 160 | pars['rmse'] = Qtools.rmse()
|
@@ -190,15 +193,16 @@ def printParametersToString(pars):
|
190 | 193 | 'nonneg': 0,
|
191 | 194 | 'lipschitz_const' : 8}
|
192 | 195 |
|
193 |
| -print ("#############FGP TV GPU####################") |
| 196 | +print ("#############PD-TV (3D) CPU####################") |
194 | 197 | start_time = timeit.default_timer()
|
195 |
| -(pd_cpu3D,info_vec_cpu) = PD_TV(pars['input'], |
| 198 | +pd_cpu3D = PD_TV(pars['input'], |
196 | 199 | pars['regularisation_parameter'],
|
197 | 200 | pars['number_of_iterations'],
|
198 | 201 | pars['tolerance_constant'],
|
| 202 | + pars['lipschitz_const'], |
199 | 203 | pars['methodTV'],
|
200 | 204 | pars['nonneg'],
|
201 |
| - pars['lipschitz_const'],'cpu') |
| 205 | + device='cpu', infovector=info_vec_cpu) |
202 | 206 |
|
203 | 207 | Qtools = QualityTools(idealVol, pd_cpu3D)
|
204 | 208 | pars['rmse'] = Qtools.rmse()
|
@@ -237,11 +241,11 @@ def printParametersToString(pars):
|
237 | 241 |
|
238 | 242 | print ("#############SB TV CPU####################")
|
239 | 243 | start_time = timeit.default_timer()
|
240 |
| -(sb_cpu3D, info_vec_cpu) = SB_TV(pars['input'], |
| 244 | +sb_cpu3D = SB_TV(pars['input'], |
241 | 245 | pars['regularisation_parameter'],
|
242 | 246 | pars['number_of_iterations'],
|
243 | 247 | pars['tolerance_constant'],
|
244 |
| - pars['methodTV'],'cpu') |
| 248 | + pars['methodTV'], device='cpu', infovector=info_vec_cpu) |
245 | 249 |
|
246 | 250 | Qtools = QualityTools(idealVol, sb_cpu3D)
|
247 | 251 | pars['rmse'] = Qtools.rmse()
|
@@ -283,12 +287,12 @@ def printParametersToString(pars):
|
283 | 287 |
|
284 | 288 | print ("#############LLT ROF CPU####################")
|
285 | 289 | start_time = timeit.default_timer()
|
286 |
| -(lltrof_cpu3D,info_vec_cpu) = LLT_ROF(pars['input'], |
| 290 | +lltrof_cpu3D = LLT_ROF(pars['input'], |
287 | 291 | pars['regularisation_parameterROF'],
|
288 | 292 | pars['regularisation_parameterLLT'],
|
289 | 293 | pars['number_of_iterations'],
|
290 | 294 | pars['time_marching_parameter'],
|
291 |
| - pars['tolerance_constant'], 'cpu') |
| 295 | + pars['tolerance_constant'], device='cpu', infovector=info_vec_cpu) |
292 | 296 |
|
293 | 297 |
|
294 | 298 | Qtools = QualityTools(idealVol, lltrof_cpu3D)
|
@@ -331,13 +335,13 @@ def printParametersToString(pars):
|
331 | 335 |
|
332 | 336 | print ("#############TGV CPU####################")
|
333 | 337 | start_time = timeit.default_timer()
|
334 |
| -(tgv_cpu3D,info_vec_cpu) = TGV(pars['input'], |
| 338 | +tgv_cpu3D = TGV(pars['input'], |
335 | 339 | pars['regularisation_parameter'],
|
336 | 340 | pars['alpha1'],
|
337 | 341 | pars['alpha0'],
|
338 | 342 | pars['number_of_iterations'],
|
339 | 343 | pars['LipshitzConstant'],
|
340 |
| - pars['tolerance_constant'],'cpu') |
| 344 | + pars['tolerance_constant'], device='cpu', infovector=info_vec_cpu) |
341 | 345 |
|
342 | 346 |
|
343 | 347 | Qtools = QualityTools(idealVol, tgv_cpu3D)
|
@@ -380,13 +384,13 @@ def printParametersToString(pars):
|
380 | 384 |
|
381 | 385 | print ("#############NDF CPU################")
|
382 | 386 | start_time = timeit.default_timer()
|
383 |
| -(ndf_cpu3D,info_vec_cpu) = NDF(pars['input'], |
| 387 | +ndf_cpu3D = NDF(pars['input'], |
384 | 388 | pars['regularisation_parameter'],
|
385 | 389 | pars['edge_parameter'],
|
386 | 390 | pars['number_of_iterations'],
|
387 | 391 | pars['time_marching_parameter'],
|
388 | 392 | pars['penalty_type'],
|
389 |
| - pars['tolerance_constant'], 'cpu') |
| 393 | + pars['tolerance_constant'], device='cpu', infovector=info_vec_cpu) |
390 | 394 |
|
391 | 395 |
|
392 | 396 | Qtools = QualityTools(idealVol, ndf_cpu3D)
|
@@ -428,12 +432,12 @@ def printParametersToString(pars):
|
428 | 432 |
|
429 | 433 | print ("#############Diff4th CPU################")
|
430 | 434 | start_time = timeit.default_timer()
|
431 |
| -(diff4th_cpu3D,info_vec_cpu) = Diff4th(pars['input'], |
| 435 | +diff4th_cpu3D = Diff4th(pars['input'], |
432 | 436 | pars['regularisation_parameter'],
|
433 | 437 | pars['edge_parameter'],
|
434 | 438 | pars['number_of_iterations'],
|
435 | 439 | pars['time_marching_parameter'],
|
436 |
| - pars['tolerance_constant'],'cpu') |
| 440 | + pars['tolerance_constant'], device='cpu', infovector=info_vec_cpu) |
437 | 441 |
|
438 | 442 |
|
439 | 443 | Qtools = QualityTools(idealVol, diff4th_cpu3D)
|
@@ -477,14 +481,14 @@ def printParametersToString(pars):
|
477 | 481 |
|
478 | 482 | print ("#############FGP dTV CPU####################")
|
479 | 483 | start_time = timeit.default_timer()
|
480 |
| -(fgp_dTV_cpu3D,info_vec_cpu) = FGP_dTV(pars['input'], |
| 484 | +fgp_dTV_cpu3D = FGP_dTV(pars['input'], |
481 | 485 | pars['refdata'],
|
482 | 486 | pars['regularisation_parameter'],
|
483 | 487 | pars['number_of_iterations'],
|
484 | 488 | pars['tolerance_constant'],
|
485 | 489 | pars['eta_const'],
|
486 | 490 | pars['methodTV'],
|
487 |
| - pars['nonneg'],'cpu') |
| 491 | + pars['nonneg'], device='cpu', infovector=info_vec_cpu) |
488 | 492 |
|
489 | 493 |
|
490 | 494 | Qtools = QualityTools(idealVol, fgp_dTV_cpu3D)
|
|
0 commit comments