From ea27a1f3fa285a621b5e327a5a36aef9d5a5018a Mon Sep 17 00:00:00 2001 From: Edoardo Pasca Date: Tue, 31 Oct 2017 12:49:49 +0000 Subject: test class rather than script --- src/Python/test/test_reconstructor-os.py | 34 +++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/Python/test/test_reconstructor-os.py b/src/Python/test/test_reconstructor-os.py index 8a0aad8..78b24a3 100644 --- a/src/Python/test/test_reconstructor-os.py +++ b/src/Python/test/test_reconstructor-os.py @@ -85,10 +85,13 @@ fistaRecon = FISTAReconstructor(proj_geom, device=astradevice) print ("Lipschitz Constant {0}".format(fistaRecon.pars['Lipschitz_constant'])) -fistaRecon.setParameter(number_of_iterations = 12) +fistaRecon.setParameter(number_of_iterations = 2) fistaRecon.setParameter(Lipschitz_constant = 767893952.0) fistaRecon.setParameter(ring_alpha = 21) fistaRecon.setParameter(ring_lambda_R_L1 = 0.002) +fistaRecon.setParameter(ring_lambda_R_L1 = 0) +subsets = 8 +fistaRecon.setParameter(subsets=subsets) #reg = Regularizer(Regularizer.Algorithm.FGP_TV) @@ -130,7 +133,7 @@ else: counter = counter + binsDiscr[jj] - 1 -if True: +if False: print ("Lipschitz Constant {0}".format(fistaRecon.pars['Lipschitz_constant'])) print ("prepare for iteration") fistaRecon.prepareForIteration() @@ -361,15 +364,40 @@ if True: numpy.save("X_out_os.npy", X) else: + astradevice = AstraDevice(DeviceModel.DeviceType.PARALLEL3D.value, + [proj_geom['DetectorRowCount'] , + proj_geom['DetectorColCount'] , + proj_geom['DetectorSpacingX'] , + proj_geom['DetectorSpacingY'] , + proj_geom['ProjectionAngles'] + ], + [ + vol_geom['GridColCount'], + vol_geom['GridRowCount'], + vol_geom['GridSliceCount'] ] ) + regul = Regularizer(Regularizer.Algorithm.FGP_TV) + regul.setParameter(regularization_parameter=5e6, + number_of_iterations=50, + tolerance_constant=1e-4, + TV_penalty=Regularizer.TotalVariationPenalty.isotropic) + fistaRecon = FISTAReconstructor(proj_geom, vol_geom, Sino3D , - weights=Weights3D) + weights=Weights3D, + device=astradevice, + regularizer = regul, + subsets=8) print ("Lipschitz Constant {0}".format(fistaRecon.pars['Lipschitz_constant'])) fistaRecon.setParameter(number_of_iterations = 12) fistaRecon.setParameter(Lipschitz_constant = 767893952.0) fistaRecon.setParameter(ring_alpha = 21) fistaRecon.setParameter(ring_lambda_R_L1 = 0.002) + #fistaRecon.setParameter(subsets=8) + + lc = fistaRecon.getParameter('Lipschitz_constant') + fistaRecon.getParameter('regularizer').setParameter(regularization_parameter=5e6/lc) + fistaRecon.prepareForIteration() X = fistaRecon.iterate(numpy.load("X.npy")) -- cgit v1.2.3