LPrecΒΆ

Here is an example on how to use the log-polar based method (https://github.com/math-vrn/lprec) for reconstruction in Tomopy

%pylab inline
Populating the interactive namespace from numpy and matplotlib

Install lprec from github, then

import tomopy

DXchange is installed with tomopy to provide support for tomographic data loading. Various data format from all major synchrotron facilities are supported.

import dxchange

matplotlib provide plotting of the result in this notebook. Paraview or other tools are available for more sophisticated 3D rendering.

import matplotlib.pyplot as plt

Set the path to the micro-CT data to reconstruct.

fname = '../../tomopy/data/tooth.h5'

Select the sinogram range to reconstruct.

start = 0
end = 2

This data set file format follows the APS beamline 2-BM and 32-ID definition. Other file format readers are available at DXchange.

proj, flat, dark, theta = dxchange.read_aps_32id(fname, sino=(start, end))

Plot the sinogram:

plt.imshow(proj[:, 0, :], cmap='Greys_r')
plt.show()
../_images/output_15_01.png

If the angular information is not avaialable from the raw data you need to set the data collection angles. In this case theta is set as equally spaced between 0-180 degrees.

theta = tomopy.angles(proj.shape[0])

Perform the flat-field correction of raw data:

\[\frac{proj - dark} {flat - dark}\]
proj = tomopy.normalize(proj, flat, dark)

Select the rotation center manually

rot_center = 296

Calculate

\[-log(proj)\]
proj = tomopy.minus_log(proj)

Reconstruction using FBP method with the log-polar coordinates

recon = tomopy.recon(proj, theta, center=rot_center, algorithm=tomopy.lprec, lpmethod='lpfbp', filter_name='parzen')

Mask each reconstructed slice with a circle.

recon = tomopy.circ_mask(recon, axis=0, ratio=0.95)
plt.imshow(recon[0, :,:], cmap='Greys_r')
plt.show()
../_images/output_28_01.png

Reconstruction using the gradient descent method with the log-polar coordinates

recon = tomopy.recon(proj, theta, center=rot_center, algorithm=tomopy.lprec, lpmethod='lpgrad', ncore=1, num_iter=64, reg_par=-1)
recon = tomopy.circ_mask(recon, axis=0, ratio=0.95)
plt.imshow(recon[0, :,:], cmap='Greys_r')
plt.show()
../_images/output_30_01.png

Reconstruction using the TV method with the log-polar coordinates

recon = tomopy.recon(proj, theta, center=rot_center, algorithm=tomopy.lprec, lpmethod='lptv', ncore=1, num_iter=256, reg_par=2e-4)
recon = tomopy.circ_mask(recon, axis=0, ratio=0.95)
plt.imshow(recon[0, :,:], cmap='Greys_r')
plt.show()
../_images/output_32_01.png

Reconstruction using the MLEM method with the log-polar coordinates

recon = tomopy.recon(proj, theta, center=rot_center, algorithm=tomopy.lprec, lpmethod='lpem', ncore=1, num_iter=64, reg_par=0.05)
recon = tomopy.circ_mask(recon, axis=0, ratio=0.95)
plt.imshow(recon[0, :,:], cmap='Greys_r')
plt.show()
../_images/output_34_01.png