APS 1-IDΒΆ
This section contains a script to read the APS 1-ID tomography dataset and reconstruct it with tomoPy.
Download file: rec_aps_1id.py
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4"""
5TomoPy example script to reconstruct the APS 1-ID tomography data as original tiff.
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_name_prefix'
16
17 # Select the sinogram range to reconstruct.
18 start = 0
19 end = 16
20
21 # Read the APS 1-ID raw data.
22 proj, flat, dark = dxchange.read_aps_1id(fname, sino=(start, end))
23
24 # Set data collection angles as equally spaced between 0-180 degrees.
25 theta = tomopy.angles(proj.shape[0])
26
27 # Flat-field correction of raw data.
28 proj = tomopy.normalize(proj, flat, dark)
29
30 # Find rotation center.
31 rot_center = tomopy.find_center(proj, theta, init=1024, ind=0, tol=0.5)
32 print("Center of rotation: ", rot_center)
33
34 proj = tomopy.minus_log(proj)
35
36 # Reconstruct object using Gridrec algorithm.
37 rec = tomopy.recon(proj, theta, center=rot_center, algorithm='gridrec')
38
39 # Mask each reconstructed slice with a circle.
40 rec = tomopy.circ_mask(rec, axis=0, ratio=0.95)
41
42 # Write data as stack of TIFs.
43 dxchange.write_tiff_stack(rec, fname='recon_dir/recon')