summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2017-10-31 12:49:49 +0000
committerEdoardo Pasca <edo.paskino@gmail.com>2018-01-19 14:26:06 +0000
commitea27a1f3fa285a621b5e327a5a36aef9d5a5018a (patch)
treea25aa5d1856c800b0adb90ce83ed67238700abf5
parent79dee31236454d56136cea8b63ede769b78d9839 (diff)
downloadregularization-ea27a1f3fa285a621b5e327a5a36aef9d5a5018a.tar.gz
regularization-ea27a1f3fa285a621b5e327a5a36aef9d5a5018a.tar.bz2
regularization-ea27a1f3fa285a621b5e327a5a36aef9d5a5018a.tar.xz
regularization-ea27a1f3fa285a621b5e327a5a36aef9d5a5018a.zip
test class rather than script
-rw-r--r--src/Python/test/test_reconstructor-os.py34
1 files 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"))