Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
pub
CTRecon
Commits
1ed4bb8c
Commit
1ed4bb8c
authored
Nov 05, 2018
by
Will Langford
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding gridrec.py
parent
8591b731
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
0 deletions
+85
-0
.gitignore
.gitignore
+1
-0
README.md
README.md
+2
-0
gridrec.py
gridrec.py
+82
-0
images/coil_tomopy_recon.gif
images/coil_tomopy_recon.gif
+0
-0
No files found.
.gitignore
0 → 100644
View file @
1ed4bb8c
_data/
\ No newline at end of file
README.md
View file @
1ed4bb8c
...
...
@@ -2,6 +2,8 @@
## Tomopy

### Gridrec
*
parallel beam
...
...
gridrec.py
0 → 100644
View file @
1ed4bb8c
# coding: utf-8
# ## Gridrec
#
# Here is an example on how to use [TomoPy](http://tomopy.readthedocs.io/en/latest/) with the gridrec algorithm.
#
# [user manual](https://media.readthedocs.org/pdf/tomopy/latest/tomopy.pdf)
# In[3]:
# get_ipython().run_line_magic('pylab', 'inline')
# In[4]:
import
tomopy
import
dxchange
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
ipyvolume
as
ipv
if
__name__
==
'__main__'
:
haveLoaded
=
False
if
(
haveLoaded
):
print
(
"loading projection data..."
)
proj
=
np
.
load
(
"projection_data.npy"
)
else
:
print
(
"loading angle data..."
)
ctdata
=
np
.
loadtxt
(
"test_scan_250/_ctdata.txt"
,
skiprows
=
3
)
theta
=
np
.
deg2rad
(
ctdata
[:,
1
])
fname
=
'_data/test_scan_250/test scan 250_0001.tif'
print
(
"loading tiff stack..."
)
indices
=
[
i
for
i
in
range
(
1
,
752
)]
data
=
dxchange
.
read_tiff_stack
(
fname
,
indices
)
print
(
np
.
shape
(
data
))
# downsample and minus log
print
(
"downsampling and taking minus log..."
)
proj
=
tomopy
.
minus_log
(
data
[::
1
,::
8
,::
8
])
print
(
np
.
shape
(
proj
))
print
(
"saving projection data..."
)
np
.
save
(
'projection_data'
,
proj
)
rot_center
=
proj
.
shape
[
2
]
/
2
# gridrec
print
(
"running reconstruction..."
)
rec
=
tomopy
.
recon
(
proj
,
theta
,
sinogram_order
=
False
,
center
=
rot_center
,
algorithm
=
'art'
)
# LPrec (not working)
# rec = tomopy.recon(proj, theta, center=rot_center,
# algorithm=tomopy.lprec, lpmethod='lpfbp',
# filter_name='parzen')
# ASTRA (not working)
options
=
{
'proj_type'
:
'linear'
,
'method'
:
'FBP'
}
rec
=
tomopy
.
recon
(
proj
,
theta
,
center
=
rot_center
,
algorithm
=
tomopy
.
astra
,
options
=
options
)
print
(
"applying circular mask..."
)
rec
=
tomopy
.
circ_mask
(
rec
,
axis
=
0
,
ratio
=
0.75
)
print
(
"saving data to reconstruction_data.npy..."
)
np
.
save
(
'reconstruction_data'
,
rec
)
# use jupyter notebook to visualize results
# print("visualizing...")
# ipv.figure()
# vol = ipv.volshow(rec)
# ipv.show()
images/coil_tomopy_recon.gif
0 → 100644
View file @
1ed4bb8c
6.8 MB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment