summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2017-10-31 11:48:10 +0000
committerEdoardo Pasca <edo.paskino@gmail.com>2017-10-31 11:48:10 +0000
commitc40959c88791f87a144d9e7ae0f81694e6a6ff2e (patch)
tree3e54976e34ac54ed9c37f1e0a1086ab700b103c7 /src
parent4bbfd47b88b34b7a7ba1545f5f47de1fc4d15cc5 (diff)
downloadregularization-c40959c88791f87a144d9e7ae0f81694e6a6ff2e.tar.gz
regularization-c40959c88791f87a144d9e7ae0f81694e6a6ff2e.tar.bz2
regularization-c40959c88791f87a144d9e7ae0f81694e6a6ff2e.tar.xz
regularization-c40959c88791f87a144d9e7ae0f81694e6a6ff2e.zip
demo updated
Diffstat (limited to 'src')
-rw-r--r--src/Python/test/test_reconstructor.py54
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)