LLNL / LEAP

comprehensive library of 3D transmission Computed Tomography (CT) algorithms with Python and C++ APIs, a PyQt GUI, and fully integrated with PyTorch
https://leapct.readthedocs.io
MIT License
104 stars 10 forks source link

Oblique CT supporting #34

Closed hws203 closed 4 months ago

hws203 commented 4 months ago

Is there any demo example of oblique CBCT(Laminography CT) at LEAP packet?

kylechampley commented 4 months ago

Hello.

There was not a demo script for laminography, but I just added one to my current development branch. You can find it on the champley_dev branch here. This will be merged into the main branch in about a week when I am done with my next round of changes.

Take a look at what I posted and let me know if you have any questions.

hws203 commented 4 months ago

I tested your "d32_laminography.py" which works well, but when I change the lami_angle from 10 to 40, then the reconstructed image is too bad. Could you explain why that happens?

lamino_angle_10 lamino_angle_40

kylechampley commented 4 months ago

Yep, I can explain. This is caused by two issues. The first issue is simple. I set the detector size to only fit that object if the laminography angle was less than 10 degrees. If you want to try bigger angles, you have to use a bigger detector. You should see a line in the script that says numRows = numCols//3 Just change this to: numRows = numCols And that way the whole object will be captured on the detector.

Once you make this change things will look better, but you will still see artifacts. These artifacts are called "cone beam artifacts". Basically, for CT to work, one must collect projections that are tangent (or nearly tangent) to all the strong edges in the object. Since none the projections in laminography measure tangent to the top and bottom edges of the cylinder, you will see strong artifacts. This is a little bit related to the type of phantom I chose. I could have chosen a phantom without sharp edges, but I also wanted to showcase how bad laminography images can look. That said, 40 degrees is a large laminography angle. Do you really need such a large angle?

Now let's talk about methods to suppress these cone-beam artifacts. One easy method is to restrict your volume to cover exactly the support of your object. In this case, that's about 28 slices (use leapct.set_numZ(28)). Next you can try regularized reconstruction to mitigate these artifacts. In LEAP you could try TV or histogram sparsity- these tend to work well.

For a description of the cone-beam artifact, see Section 2.1 and Figure 1 of the following paper (one of my papers actually): https://www.sciencedirect.com/science/article/am/pii/S0963869521001997

I also wrote a paper that describes a heuristic method to mitigate cone-beam artifacts. That paper is here: https://link.springer.com/article/10.1007/s11220-023-00444-3

Hope this helps.

hws203 commented 4 months ago

Now I can see better a slice image after change the size of detector by 512. As you can see the geometry figure, the detector is parallel to Z-axis, which may bring some degrading of gray value from top to bottom of detector at real case. Is there any method to tilt the detector position as like the attached image ? Thanks for your quick response. lamin_geo

kylechampley commented 4 months ago

Yes, you can rotate the detectors as well. The easiest way I know to do this is with quaternions. Add the following code just before the set_modularbeam command.

from scipy.spatial.transform import Rotation as R sin_theta = np.sin(-0.5laminographyAnglenp.pi/180.0) cos_theta = np.cos(-0.5laminographyAnglenp.pi/180.0) for n in range(numAngles): q = np.append(colVecs[n,:].copy()*sin_theta, cos_theta) A = R.from_quat(q).as_matrix() rowVecs[n,:] = np.matmul(A, rowVecs[n,:])

Note that if you rotate the detectors more than 5 degrees, the FBP reconstruction will no longer work, so you'll have to do iterative reconstruction.

hws203 commented 4 months ago

Thanks for your nice guidance. Now I can see the tilted geometry of CBCT and some slices too with SART algorithm.

kylechampley commented 4 months ago

Do you have any more questions related to this issue? If you do, I'd be happy to leave it open and answer more questions, but if not, can I close this issue?

kylechampley commented 4 months ago

I'm going to close this issue because of inactivity and because I think I answered all of your questions, but feel free to open a new issue if something comes up.