APS 2-BM & 32-IDΒΆ

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

Download file: rec_aps_32id_full.py

 1#!/usr/bin/env python
 2# -*- coding: utf-8 -*-
 3
 4"""
 5TomoPy example script to reconstruct TXM data set.
 6"""
 7
 8from __future__ import print_function
 9import tomopy
10import dxchange
11
12if __name__ == '__main__':
13
14    # Set path to the micro-CT data to reconstruct.
15    fname = 'data_dir/sample.h5'
16
17    # Select sinogram range to reconstruct.
18    start = 0
19    end = 16
20
21    # Read APS 32-ID raw data.
22    proj, flat, dark, theta = dxchange.read_aps_32id(fname, sino=(start, end))
23
24    # If data collection angles is not defined in the hdf file then set it as equally spaced between 0-180 degrees.
25    if (theta is None):
26        theta = tomopy.angles(proj.shape[0])
27    else:
28        pass
29
30    # Flat-field correction of raw data.
31    proj = tomopy.normalize(proj, flat, dark)
32
33    # Find rotation center.
34    rot_center = tomopy.find_center(proj, theta, ind=0, init=1024, tol=0.5)
35    print("Center of rotation: ", rot_center)
36
37    proj = tomopy.minus_log(proj)
38
39    # Reconstruct object using Gridrec algorithm.
40    rec = tomopy.recon(proj, theta, center=rot_center, algorithm='gridrec')
41
42    # Mask each reconstructed slice with a circle.
43    rec = tomopy.circ_mask(rec, axis=0, ratio=0.95)
44
45    # Write data as stack of TIFs.
46    dxchange.write_tiff_stack(rec, fname='recon_dir/recon')