LLNL / LEAP

comprehensive library of 3D transmission Computed Tomography (CT) algorithms with Python API and fully integrated with PyTorch
https://leapct.readthedocs.io
MIT License
74 stars 8 forks source link

Tilt the angle of stage rotation axis #60

Closed hws203 closed 1 week ago

hws203 commented 1 week ago

@kylechampley Could you guide me how to tilt the angle of rotation at stage ? I know that Leap supports detector rotation. But I cannot find how to tilt the angle of rotation stage axis which should be less than 5 degree from z-axis as you comment. And let me know the reason of this 5 degree limit is necessary.

hws203 commented 1 week ago

Leap does not support this feature ? And the threshold of 5 degree is max-value not to degrade slice image?

kylechampley commented 1 week ago

@hws203 that 5-degree spec that you are referring to only applies to FBP. You can put your sources and detectors pretty much anywhere and reconstruct with iterative reconstruction. For example, see d05_3DflashCT.py.

In addition, that 5-degree spec is somewhat arbitrary. The quality of FBP reconstruction with a rotated detector gets worse as the rotation angle gets larger. I just cut it off at 5 degrees to force users into using iterative reconstruction.

Below is some code to get you started on modeling a rotation axis that is not aligned with the z-axis. It is basically an adaptation of d04_modularbeam.py

# Set the axis of rotation
z = np.array([0.05, 0.05, 1.0])
z = z / np.sqrt(np.dot(z,z))

# Now specify two vectors orthogonal to the axis of rotation
x = np.array([1.0, 0.0, 0.0])
y = np.array([0.0, 1.0, 0.0])
x = x - np.dot(x,z)*z
x = x / np.sqrt(np.dot(x,x))
y = y - np.dot(y,z)*z - np.dot(y,x)*x
y = y / np.sqrt(np.dot(y,y))

T_phi = 2.0*np.pi/float(numAngles)
for n in range(numAngles):
    phi = n*T_phi-0.5*np.pi

    sourcePositions[n,0] = sod*(np.cos(phi)*x[0] + np.sin(phi)*y[0])
    sourcePositions[n,1] = sod*(np.cos(phi)*x[1] + np.sin(phi)*y[1])
    sourcePositions[n,2] = sod*(np.cos(phi)*x[2] + np.sin(phi)*y[2])

    moduleCenters[n,0] = (sod-sdd)*(np.cos(phi)*x[0] + np.sin(phi)*y[0])
    moduleCenters[n,1] = (sod-sdd)*(np.cos(phi)*x[1] + np.sin(phi)*y[1])
    moduleCenters[n,2] = (sod-sdd)*(np.cos(phi)*x[2] + np.sin(phi)*y[2])
hws203 commented 1 week ago

Thanks so much for your nice explanation.