-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCGLS_reco_skullCT_2D.py
executable file
·39 lines (28 loc) · 1.06 KB
/
CGLS_reco_skullCT_2D.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
CGLS reconstruction example for simulated Skull CT data
Note: So far only works for phantom_number = '70100644'
"""
import odl
import numpy as np
import adutils
# Discretization
reco_space = adutils.get_discretization(use_2D=True)
# Forward operator (in the form of a broadcast operator)
A = adutils.get_ray_trafo(reco_space, use_2D=True)
# Data
rhs = adutils.get_data(A, use_2D=True)
# Reconstruct
title = 'my reco'
callbackShowReco = (odl.solvers.CallbackPrintIteration() &
odl.solvers.CallbackShow(clim=[0.018, 0.022]))
callbackPrintIter = (odl.solvers.CallbackPrintIteration())
# Start with initial guess
x = adutils.get_initial_guess(reco_space)
#x = A.domain.zero()
# Run such that the solution is saved to local repo (saveReco = True), or not (saveReco = False)
saveReco = False
niter = 30
odl.solvers.conjugate_gradient_normal(A, x, rhs, niter=niter, callback=callbackShowReco)
if saveReco:
saveName = '/home/davlars/Reco_HelicalSkullCT_70100644Phantom_no_bed_Dose150mGy_CGLS_' + str(niter) + 'iterations'
adutils.save_image(x, saveName)