CERN / TIGRE

TIGRE: Tomographic Iterative GPU-based Reconstruction Toolbox
BSD 3-Clause "New" or "Revised" License
527 stars 180 forks source link

Question about arbitrary axis of rotation using TIGRE #562

Closed 1999kevin closed 1 week ago

1999kevin commented 1 week ago

Expected Behavior

I want to first rotate the detector around Z-axis for angle0 and then rotate the detector around Y-axis for angle1, as shown in below figure: image

Code to reproduce the problem (If applicable)

Is it possible to achieve this function with such code:

anglesZ1 = np.linspace(0, np.pi, numProjs)
anglesY = np.linspace(0, np.pi, numProjs)
anglesZ2 = np.zeros_like(anglesZ1)
angles = np.vstack([anglesZ1, anglesY, anglesZ2]).T
projections = tigre.Ax(head, geo, angles)

If not, could you please provide a figure about ZYZ configuration to illustrate the function of anglesZ1, anglesY, anglesZ2?

AnderBiguri commented 1 week ago

As from the email:

Ah, this is complicated geometry that you have, as it snot really what I am trying to describe with the arbitrary axis of rotation exactly. Arbitrary axis of rotations assumes that source-detector are still coupled together, which is not your case. For this, you need a mix of geometries that is not super easy to input into TIGRE, but of course is possible.

do the following: 1-Put the source where you want. Indeed, this requires a rotation around Y first (theta 1) and then around Z (theta 0). You need ZYZ but the first Z is =0. 2-Now that the source is where it should be in your drawing, imagine where the detector is, and what rotation it has. It should be exactly opposite the yellow DSO line of your drawing. But that is not what you want! 3- Find out how to move the detector from its current location to where you want it. This will be a combitanion of geo.offDetector, geo.DSD to put it in the right place, but then geo.rotDetector to make it look at the appopiate direction

Hope this helps!

1999kevin commented 1 week ago

Thank you very much for your quick reply!

What do you mean by saying "source-detector are still coupled together"? Do you mean the source, the origin and detector are always at the same line? This is exactly what I want. Maybe the former figure is misleading, please see the updated figure below: image

For the step 1, do you mean a pseudo code like angles = np.vstack([0, theta 1, theta 0]).T? However, as in my figure, I think it requires a rotation around Z first (theta 0) and then around Y (theta 0), which is angles = np.vstack([theta 0, theta 1, 0]).T.

I'm a little confused about the rotation order of ZYZ configuration. For ```angles = np.vstack([A, B, C]).T, does it mean a rotation around Z first for A degree and then around Y for B degree and finally around Z for C degree?

Looking forward for your reply.

AnderBiguri commented 1 week ago

ah indeed, the figure mislead me, apologies.

These are Euler angles https://en.wikipedia.org/wiki/Euler_angles So the rotations are w.r.t locally rotated axis. Indeed it could be that you want what you are proposing, not what I said :)

1999kevin commented 1 week ago

Ok, so it is what I say, angles = np.vstack([theta 0, -theta 1, 0]).T (negative angle around y-axis) to achieve my figure, right?

AnderBiguri commented 1 week ago

I think so, yes.

1999kevin commented 1 week ago

Thank you very much!!!