SLS TomcatΒΆ

This section contains a script to read the Swiss Light Source tomcat tomography dataset and reconstruct it with tomoPy.

Download file: rec_tomcat.py

 1#!/usr/bin/env python
 2# -*- coding: utf-8 -*-
 3
 4"""
 5TomoPy example script to reconstruct the Swiss Light Source TOMCAT tomography
 6data as original 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/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_sls_tomcat(fname, sino=(start, end))
23
24    # Set data collection angles as equally spaced between 0-180 degrees.
25    theta = tomopy.angles(proj.shape[0], 0, 180)
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,
32                                    ind=0, tol=0.5)
33    print("Center of rotation:", rot_center)
34
35    proj = tomopy.minus_log(proj)
36
37    # Reconstruct object using Gridrec algorithm.
38    rec = tomopy.recon(proj, theta, center=rot_center, algorithm='gridrec')
39
40    # Mask each reconstructed slice with a circle.
41    rec = tomopy.circ_mask(rec, axis=0, ratio=0.95)
42
43    # Write data as stack of TIFs.
44    dxchange.write_tiff_stack(rec, fname='recon_dir/recon')