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>2017-10-31 12:49:49 +0000
commitf0ff4af86c11f46ed8d073787f13c135934dd2d9 (patch)
tree8e8a4113ff032dd8dce5495d37051e36f80bd945
parent0174c3226d9d540d0adc874436bf5b8f7a80f9b5 (diff)
downloadregularization-f0ff4af86c11f46ed8d073787f13c135934dd2d9.tar.gz
regularization-f0ff4af86c11f46ed8d073787f13c135934dd2d9.tar.bz2
regularization-f0ff4af86c11f46ed8d073787f13c135934dd2d9.tar.xz
regularization-f0ff4af86c11f46ed8d073787f13c135934dd2d9.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"))