diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2017-10-31 11:48:10 +0000 |
---|---|---|
committer | Edoardo Pasca <edo.paskino@gmail.com> | 2018-01-19 14:26:06 +0000 |
commit | ad76db22da72815489ed95710f6d8e83904d8fd4 (patch) | |
tree | d3349d21a93b6ebe600b83cd24cd7a0139000ea8 /src/Python | |
parent | 0b8e774ee12b9d3bbdb644c5046eff490269dc85 (diff) | |
download | regularization-ad76db22da72815489ed95710f6d8e83904d8fd4.tar.gz regularization-ad76db22da72815489ed95710f6d8e83904d8fd4.tar.bz2 regularization-ad76db22da72815489ed95710f6d8e83904d8fd4.tar.xz regularization-ad76db22da72815489ed95710f6d8e83904d8fd4.zip |
demo updated
Diffstat (limited to 'src/Python')
-rw-r--r-- | src/Python/test/test_reconstructor.py | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/src/Python/test/test_reconstructor.py b/src/Python/test/test_reconstructor.py index f4627d7..40065e7 100644 --- a/src/Python/test/test_reconstructor.py +++ b/src/Python/test/test_reconstructor.py @@ -315,16 +315,36 @@ if False: else: # create a device for forward/backprojection - astradevice = createAstraDevice(proj_geom, vol_geom) + #astradevice = createAstraDevice(proj_geom, vol_geom) + + 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 , device = astradevice, - weights=Weights3D + weights=Weights3D, + regularizer = regul ) print ("Lipschitz Constant {0}".format(fistaRecon.pars['Lipschitz_constant'])) - fistaRecon.setParameter(number_of_iterations = 3) + fistaRecon.setParameter(number_of_iterations = 18) fistaRecon.setParameter(Lipschitz_constant = 767893952.0) fistaRecon.setParameter(ring_alpha = 21) fistaRecon.setParameter(ring_lambda_R_L1 = 0.002) @@ -333,33 +353,7 @@ else: fistaRecon.prepareForIteration() X = numpy.load("X.npy") -## rd = astradevice.createReducedDevice() -## print ("rd proj_geom" , rd.proj_geom) -## -## -## rd.doForwardProject(X[0:1]) -## proj_geomT = proj_geom.copy() -## for ekey in rd.proj_geom.keys(): -## if ekey == 'ProjectionAngles': -## valrd = numpy.shape(rd.proj_geom[ekey]) -## valg = numpy.shape(proj_geomT[ekey]) -## else: -## valrd = rd.proj_geom[ekey] -## valg = proj_geomT[ekey] -## -## print ("key {0}: RD {1} geomT {2}".format(ekey, valrd, valg)) -## -## -## proj_geomT['DetectorRowCount'] = 1 -## vol_geomT = vol_geom.copy() -## vol_geomT['GridSliceCount'] = 1; -## rd.proj_geom = proj_geomT.copy() -## rd.vol_geom = vol_geomT.copy() -## -## -## -## sino_id, y = astra.creators.create_sino3d_gpu( -## X[0:1], rd.proj_geom, rd.vol_geom) + X = fistaRecon.iterate(X) #numpy.save("X_out.npy", X) |