Tomosaic is a library for Panoramic or Mosaic Tomography.
Get this repository to your hard drive using
git clone https://github.com/mdw771/tomosaic2
and then use PIP to build and install:
pip install -e ./tomosaic2
We have made a working example dataset (the charcoal data shown in the paper) public on TomoBank, so that anyone can grab the data for a trial run! Data can be downloaded from here.
The most convenient way to use Tomosaic is through Automo, a higher-level wrapper for Tomosaic which also includes a collection of script files to be used in the Tomosaic workflow. If you would rather not use Automo, move on to the following:
Get the tomosaic script templates from here. Again, you can do
git clone https://github.com/mdw771/tomosaic_templates
Copy the Python scripts to the same directory where you save all the HDF5 data files. Then, follow these steps for mosaic reconstruction:
-
Make sure all HDF5 files are named in the pattern of
prefix_y?_x?.h5. The indices of tiles should start from 0, from left to right, top to bottom of the collection positions on the sample. -
Run
python mosaic_reorganizein the data directory. This will put all original HDF5 files in a folder calleddata_raw_1x; if you want to have downsampled copies of the data, use the--dsflag to indicate the downsampling ratios (remember to include 1), e.g.,--ds 1,2,4. -
Open
mosaic_meta.py, and enter the filename prefix, and estimated y and x offset (in pixel). Changedata_formatif necessary; if you are unsure of how to refer to your data format, see dxchangehttps://github.com/data-exchange/dxchange's documentation. Usepython mosaic_meta.pyto run this script. -
Run
python mosaic_preview.py --pano 0; python mosaic_preview.py --pano <last_frame>(If a total of 2000 projections are collected, then<last_frame>should be 1999). This creates the stitched panorama at 0 and 180 degrees, saved in thepreview_panosfolder. -
Run
python mosaic_find_center.py. It will write reconstructions generated with a series of rotation center settings (+/- 5 from the phase correlation guess, calculated using the 0 and 180 projections generated in step 3) into./center. You can then check those output files to manually refine the center. -
Open
center_pos.txtwhich is created automatically in the last step. If a phase correlation guess was done, the file should contain something like
0 xxxx
1 xxxx
where the first integer at each line is the grid row index, and the second number is the center value. Change the values to your manually refined results (if applicable).
- Open
mosaic_recon.py, setslice_standslice_end, make suremodeisdiscrete, and runpython mosaic_recon.py.
(Note: Mode discrete stitches sinograms for each slice instead of doing x-y stitching for each projection angle. The latter is called the merged mode and requires you to create a merged HDF5 file before reconstruction. This can be done using mosaic_merge.py. For details, please read the Automo documentation.)
Vescovi, R. et al. Tomosaic: efficient acquisition and reconstruction of teravoxel tomography data using limited-size synchrotron X-ray beams. Journal of Synchrotron Radiation 25, (2018).