Elettra SyrmepΒΆ

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

Download file: rec_elettra.py

 1#!/usr/bin/env python
 2# -*- coding: utf-8 -*-
 3
 4"""
 5TomoPy example script to reconstruct the Elettra syrmep 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 CT data to reconstruct.
15    fname = 'data_dir/'
16
17    proj_start = 1
18    proj_end = 1801
19    flat_start = 1
20    flat_end = 11
21    dark_start = 1
22    dark_end = 11
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 Elettra syrmep
33    proj, flat, dark = dxchange.read_elettra_syrmep(fname, ind_tomo, ind_flat, ind_dark, sino=(start, end))
34
35    # Set data collection angles as equally spaced between 0-180 degrees.
36    theta = tomopy.angles(proj.shape[0], 0, 180)
37
38    # Flat-field correction of raw data.
39    proj = tomopy.normalize(proj, flat, dark)
40
41    # Find rotation center.
42    rot_center = tomopy.find_center(proj, theta, init=1024, ind=0, tol=0.5)
43    print("Center of rotation: ", rot_center)
44
45    proj = tomopy.minus_log(proj)
46
47    # Reconstruct object using Gridrec algorithm.
48    rec = tomopy.recon(proj, theta, center=rot_center, algorithm='gridrec')
49
50    # Mask each reconstructed slice with a circle.
51    rec = tomopy.circ_mask(rec, axis=0, ratio=0.95)
52
53    # Write data as stack of TIFs.
54    dxchange.write_tiff_stack(rec, fname='recon_dir/recon')