APS 5-BMΒΆ

This section contains a script to read the APS 5-BM tomography dataset and reconstruct it with tomoPy.

Download file: rec_aps_5bm.py

 1#!/usr/bin/env python
 2# -*- coding: utf-8 -*-
 3
 4"""
 5TomoPy example script to reconstruct the APS 5-BM data as original xmt.
 6xmt are 16 bit unsigned integer tiff file that requires a byte swap before
 7being processed.
 8"""
 9
10from __future__ import print_function
11import tomopy
12import dxchange
13
14if __name__ == '__main__':
15
16    # Set path to the micro-CT data to reconstruct.
17    fname = 'data_dir/'
18
19    # Select the sinogram range to reconstruct.
20    start = 290
21    end = 294
22
23    # Read the APS 5-BM raw data
24    proj, flat, dark = dxchange.read_aps_5bm(fname, sino=(start, end))
25
26    # Set data collection angles as equally spaced between 0-180 degrees.
27    theta = tomopy.angles(proj.shape[0])
28
29    # Flat-field correction of raw data.
30    proj = tomopy.normalize(proj, flat, dark)
31
32    # remove stripes
33    proj = tomopy.remove_stripe_fw(proj,level=7,wname='sym16',sigma=1,pad=True)
34
35    # Set rotation center.
36    rot_center = proj.shape[2] / 2.0
37    print("Center of rotation: ", rot_center)
38
39    proj = tomopy.minus_log(proj)
40
41    # Reconstruct object using Gridrec algorithm.
42    rec = tomopy.recon(proj, theta, center=rot_center, algorithm='gridrec')
43
44    # Mask each reconstructed slice with a circle.
45    rec = tomopy.circ_mask(rec, axis=0, ratio=0.95)
46
47    # Write data as stack of TIFs.
48    dxchange.write_tiff_stack(rec, fname='recon_dir/recon')