Anka TopoTomoΒΆ

This section contains a script to read the Anka TopoTomo tomography dataset and reconstruct it with tomoPy.

Download file: rec_anka.py

 1#!/usr/bin/env python
 2# -*- coding: utf-8 -*-
 3
 4"""
 5TomoPy example script to reconstruct the Anka topo-tomo tomography data as
 6original tiff.
 7"""
 8
 9from __future__ import print_function
10import tomopy
11import dxchange
12
13if __name__ == '__main__':
14    # Set path to the micro-CT data to reconstruct.
15    fname = 'data_dir/'
16
17    proj_start = 0
18    proj_end = 1800
19    flat_start = 0
20    flat_end = 100
21    dark_start = 0
22    dark_end = 100
23
24    ind_tomo = range(proj_start, proj_end)
25    ind_flat = range(flat_start, flat_end)
26    ind_dark = range(dark_start, dark_end)
27
28    # Select the sinogram range to reconstruct.
29    start = 0
30    end = 16
31
32    # Read the Anka tiff raw data.
33    proj, flat, dark = dxchange.read_anka_topotomo(fname, ind_tomo, ind_flat,
34                                                 ind_dark, sino=(start, end))
35
36    # Set data collection angles as equally spaced between 0-180 degrees.
37    theta = tomopy.angles(proj.shape[0])
38
39    # Flat-field correction of raw data.
40    proj = tomopy.normalize(proj, flat, dark)
41
42    # Find rotation center.
43    rot_center = tomopy.find_center(proj, theta, init=1024,
44                                    ind=0, tol=0.5)
45    print("Center of rotation: ", rot_center)
46
47    proj = tomopy.minus_log(proj)
48
49    # Reconstruct object using Gridrec algorithm.
50    rec = tomopy.recon(proj, theta, center=rot_center, algorithm='gridrec')
51
52    # Mask each reconstructed slice with a circle.
53    rec = tomopy.circ_mask(rec, axis=0, ratio=0.95)
54
55    # Write data as stack of TIFs.
56    dxchange.write_tiff_stack(rec, fname='recon_dir/recon')