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

Detector rotation functions for three cases(skew, tilt, rolling) #41

Closed hws203 closed 3 months ago

hws203 commented 4 months ago

@kylechampley I checked your detector rotation function . And I am wondering why this function combined with two more factors, for example, tilt+skew, or skew+roll.

Detector is fixed into a equipment mechanically at most case. But there are sometime some mismatching angles of three factors. So from the real projection image, we need to extract these error angles for exact reconstruction. For this case, we may needs three separated functions for geometry correction.

I think that at least there needs to exist of three separated functions for tilt-rotate(), skew-rotate() and roll-rotate() of detector. How about your opinion ?

skew_tilt_rolling detector_rot_0_180 detector_rot_90

kylechampley commented 4 months ago

Yes, as you've pointed out LEAP only has a function to perform what you've labeled as a "skew" rotation. In LEAP we sometimes call this detector tilt (which conflicts with what you have above) and the function is leapct.rotate_detector(rotationAngleInDegrees). If you want to perform the other rotations, you have to manually manipulate the geometry specification yourself.

We have not included a function for this yet largely for three reasons: 1) there are many definitions of how to perform 3D rotations: Euler angles (extrinsic or intrinsic), quaternions, etc. Some people might think it doesn't work because they are using different rotation conventions. 2) Using your notation, one has to perform large angle "roll" and "tilt" rotations to make a significant effect on image quality. Try a reconstruction where you are off by a couple of degrees of these types of rotations and you'll see only very slight changes in the reconstruction. On the other hand, the reconstruction is heavily effected by "skew" rotations. 3) Lastly, note that one can model "roll" rotations by the "tau" parameter in LEAP.

kylechampley commented 4 months ago

I changed my mind. I'll add it to the next release. Just check the online documentation for usage.

kylechampley commented 4 months ago

A new version of LEAP has been posted that will perform these rotations. See description here: https://leapct.readthedocs.io/en/latest/ctgeometries.html#leapctype.tomographicModels.rotate_detector

hws203 commented 4 months ago

I have checked your detection rotation function which looks good. By the way, I have researched some papers about self calibration of fan-bean or cone beam ct. And I think that the paper sent to your e-mail just now may need to be checked for your Leap's new feature of self-online calibration which could be useful for not correct geometry system in real.

hws203 commented 4 months ago

At the case of 3x3 matrix input of alpha, not scalar. I can see some error message in python command as like below pictures. matrix_error01 matrix_error01_script

hws203 commented 4 months ago

Above issue is related to my own python environment. After "pip install ." command , all looks good. it is not related to your library function.

hws203 commented 4 months ago

Now I can see almost exact reconed slice of my sample owing to your new detector rotate function. Thanks for your updating. Finding the exact param of geometry is labor work.

exact_slice

ProjX0 commented 4 months ago

@hws203 The above results are very interesting. I am also attempting geometry calibration. Could I possibly see the entire code used to produce them?

hws203 commented 4 months ago

@ProjX0 My code has no special ones to make the above result, I do several manual retrials to make it. I hope that the next release LEAP can include such auto calibration feature that you want too.

kylechampley commented 4 months ago

@hws203 and @ProjX0, I am working on an automatic calibration algorithm that should be ready by the end of the week. I'll let you know when it's ready.

kylechampley commented 3 months ago

I just released v1.13 which has several bug fixes related to modular-beam with rotated detector and I added some utilities to help with geometric calibration.

See d12_geometric_calibration.py

hws203 commented 3 months ago

Yes, I have checked your new auto-cal of consistency-cost which looks nice. I can see the correct my sample slice without any labor work now. I will check it with my cylinder batter image too, Today. I really appreciate your new function for auto-cal.

full_ato_cal

kylechampley commented 3 months ago

I'm going to close this issue because it seems like things have been resolved. If you find another bug, please open a new issue, but if you just want to start a conversation about a topic, please open a new discussion thread instead.