Skip to content

Commit

Permalink
Merge pull request #39 from decarlof/master
Browse files Browse the repository at this point in the history
docs update
  • Loading branch information
decarlof committed Sep 28, 2016
2 parents 6787de9 + 359ea49 commit 373b23f
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 7 deletions.
57 changes: 57 additions & 0 deletions doc/demo/rec_aps_26id.py
@@ -0,0 +1,57 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
TomoPy example script to reconstruct the xrm tomography data from
the original stack of xrm. To use rename the xrm data as
radios/image_00000.xrm and flats/ref_00000.xrm
"""

from __future__ import print_function
import tomopy
import dxchange

if __name__ == '__main__':
# Set path to the micro-CT data to reconstruct.
fname = 'data_dir/'

proj_start = 0
proj_end = 1800
flat_start = 0
flat_end = 100

ind_tomo = range(proj_start, proj_end)
ind_flat = range(flat_start, flat_end)

# Select the sinogram range to reconstruct.
start = 0
end = 16

# Read the APS 26-ID raw data.
proj, flat, metadata = dxchange.read_aps_26id(fname, ind_tomo, ind_flat,
sino=(start, end))

# make the darks
dark = np.zeros((1, proj.shape[1], proj.shape[2]))

# Set data collection angles as equally spaced between 0-180 degrees.
theta = tomopy.angles(proj.shape[0])

# Flat-field correction of raw data.
proj = tomopy.normalize(proj, flat, dark)

# Find rotation center.
rot_center = tomopy.find_center(proj, theta, init=1024,
ind=0, tol=0.5)
print("Center of rotation: ", rot_center)

proj = tomopy.minus_log(proj)

# Reconstruct object using Gridrec algorithm.
rec = tomopy.recon(proj, theta, center=rot_center, algorithm='gridrec')

# Mask each reconstructed slice with a circle.
rec = tomopy.circ_mask(rec, axis=0, ratio=0.95)

# Write data as stack of TIFs.
dxchange.write_tiff_stack(rec, fname='recon_dir/recon')
57 changes: 57 additions & 0 deletions doc/demo/rec_aps_8bm.py
@@ -0,0 +1,57 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
TomoPy example script to reconstruct the xrm tomography data from
the original stack of xrm. To use rename the xrm data as
radios/image_00000.xrm and flats/ref_00000.xrm
"""

from __future__ import print_function
import tomopy
import dxchange

if __name__ == '__main__':
# Set path to the micro-CT data to reconstruct.
fname = 'data_dir/'

proj_start = 0
proj_end = 1800
flat_start = 0
flat_end = 100

ind_tomo = range(proj_start, proj_end)
ind_flat = range(flat_start, flat_end)

# Select the sinogram range to reconstruct.
start = 0
end = 16

# Read the APS 8-BM raw data.
proj, flat, metadata = dxchange.read_aps_8bm(fname, ind_tomo, ind_flat,
sino=(start, end))

# make the darks
dark = np.zeros((1, proj.shape[1], proj.shape[2]))

# Set data collection angles as equally spaced between 0-180 degrees.
theta = tomopy.angles(proj.shape[0])

# Flat-field correction of raw data.
proj = tomopy.normalize(proj, flat, dark)

# Find rotation center.
rot_center = tomopy.find_center(proj, theta, init=1024,
ind=0, tol=0.5)
print("Center of rotation: ", rot_center)

proj = tomopy.minus_log(proj)

# Reconstruct object using Gridrec algorithm.
rec = tomopy.recon(proj, theta, center=rot_center, algorithm='gridrec')

# Mask each reconstructed slice with a circle.
rec = tomopy.circ_mask(rec, axis=0, ratio=0.95)

# Write data as stack of TIFs.
dxchange.write_tiff_stack(rec, fname='recon_dir/recon')
6 changes: 3 additions & 3 deletions doc/demo/rec_xradia_xrm.py
Expand Up @@ -4,7 +4,7 @@
"""
TomoPy example script to reconstruct the xrm tomography data from
the original stack of xrm. To use rename the xrm data as
radios/image00000.xrm and flats/image00000.xrm
radios/image_00000.xrm and flats/ref_00000.xrm
"""

from __future__ import print_function
Expand All @@ -27,8 +27,8 @@
start = 0
end = 16

# Read the Anka tiff raw data.
proj, flat = dxchange.read_aps_26id(fname, ind_tomo, ind_flat,
# APS 26-ID has an x-radia system collecting raw data as xrm.
proj, flat, metadata = dxchange.read_aps_26id(fname, ind_tomo, ind_flat,
sino=(start, end))

# make the darks
Expand Down
2 changes: 1 addition & 1 deletion doc/source/demo.rst
@@ -1 +1 @@
Examples========Code example on how to use DXchange to import tomographic data from different synchrotron facilities and process it with TomoPy :cite:`Gursoy:14b`... toctree:: demo/doc.demo.anka demo/doc.demo.australian demo/doc.demo.als demo/doc.demo.elettra demo/doc.demo.esrf demo/doc.demo.aps_1id demo/doc.demo.aps_13bm demo/doc.demo.aps_32id demo/doc.demo.petraIII_p05 demo/doc.demo.tomcat demo/doc.demo.xradia.. automodule:: dxchange :members: :undoc-members: :show-inheritance:
Examples========Code example on how to use DXchange to import tomographic data from different synchrotron facilities and process it with TomoPy :cite:`Gursoy:14b`... toctree:: demo/doc.demo.anka demo/doc.demo.australian demo/doc.demo.als demo/doc.demo.elettra demo/doc.demo.esrf demo/doc.demo.aps_1id demo/doc.demo.aps_8bm demo/doc.demo.aps_13bm demo/doc.demo.aps_26id demo/doc.demo.aps_32id demo/doc.demo.petraIII_p05 demo/doc.demo.tomcat demo/doc.demo.xradia.. automodule:: dxchange :members: :undoc-members: :show-inheritance:
Expand Down
9 changes: 9 additions & 0 deletions doc/source/demo/doc.demo.aps_26id.rst
@@ -0,0 +1,9 @@
APS 26-ID
=========

This section contains a script to read the X-radia XRM tomography dataset and reconstruct it with tomoPy.

Download file: :download:`rec_aps_26id.py<../../../doc/demo/rec_aps_26id.py>`

.. literalinclude:: ../../../doc/demo/rec_aps_26id.py :tab-width: 4 :linenos: :language: guess
Expand Down
9 changes: 9 additions & 0 deletions doc/source/demo/doc.demo.aps_8bm.rst
@@ -0,0 +1,9 @@
APS 8-BM
========

This section contains a script to read the X-radia XRM tomography dataset and reconstruct it with tomoPy.

Download file: :download:`rec_aps_8bm.py<../../../doc/demo/rec_aps_8bm.py>`

.. literalinclude:: ../../../doc/demo/rec_aps_8bm.py :tab-width: 4 :linenos: :language: guess
Expand Down
6 changes: 3 additions & 3 deletions doc/source/demo/doc.demo.xradia.rst
@@ -1,7 +1,7 @@
X-radia XRM and TXRM
====================
X-radia XRM
===========

This section contains a script to read the X-radia XRM and TXRM tomography dataset and reconstruct it with tomoPy.
This section contains a script to read the X-radia XRM tomography dataset and reconstruct it with tomoPy.

Download file: :download:`rec_xradia_xrm.py<../../../doc/demo/rec_xradia_xrm.py>`

Expand Down

0 comments on commit 373b23f

Please sign in to comment.