-
Notifications
You must be signed in to change notification settings - Fork 284
Description
Working on some code for generating mathematical phantoms, I noticed that I was getting center of rotation artifacts when reconstructing the phantoms with TomoPy. I first thought that I was wrongly generating projections in my code, but now I think it might be due to the default center of rotation in TomoPy. To test this, I created the following minimal working example:
import numpy as np
# Create single projection of a disk
x = np.linspace(-1,1,1024)
y = np.zeros(1024)
y[np.abs(x)<=0.1] = 2*np.sqrt(0.1*0.1-x[np.abs(x)<=0.1]**2)
# Put into array with 1024 projections
projs = np.zeros((1024,1,1024), dtype=np.float32)
projs[:] = y
angles = np.linspace(0, np.pi, 1024, False)
# Reconstruct using TomoPy
import tomopy
rec_wrong_cor = tomopy.recon(projs, angles, algorithm='gridrec')
rec_correct_cor = tomopy.recon(projs, angles, algorithm='gridrec', center=(projs.shape[2]-1)/2)The code generates the projection of a disk, centered on the detector, and uses the same projection for all angles (i.e. the COR is in the middle of the disk). When reconstructing with the default COR that tomopy uses, I get COR artifacts. The last line results in a reconstruction without any COR artifacts. Reconstructing with astra also results in an image that is similar to rec_correct_cor. Images of both reconstructions (gray scale chosen to show the problem better) are shown below. Left is rec_wrong_cor, right is rec_correct_cor.
In practice, it probably doesn't really matter, since for experimental data you typically have to pick a COR that is different from the default in any case.
