Get C-arm angles from 3D view orientation

Andras,

Thanks again for the quick reply. I am confused by something that you mention both in your recent reply and in the discussion that you linked to in the VTK forum. In both places you say that you do not need to use reverse perspective for semi-transparent content because you can see through everything so it doesn’t matter what is in front and what is behind. When simulating fluoro images from a volume (or creating a model view to be overlaid on fluoro images) I believe that the reverse perspective is important event for semi-transparent content because the perspective will be wrong. Fluoro images are viewed from the perspective of the detector, such that objects closer to the x-ray tube are in the “back” and objects closer to the detector are in the “front”. For this reason, objects in the back are larger and objects in the front are smaller, which is the opposite of normal visual or camera perspective. I believe that this is what Daan Baas was trying to correct for, and it also what I am trying to correct for.

Daan Baas says that he found a 2-step solution:
"The solution I ended up with required a combination of two steps:

  1. Setting the camera position to the point exactly opposite of the focal point, as seen from the camera position (i.e. rotating the camera position around the focal point 180 degrees, with the same viewUp). This gives the desired depth inverted perspective scaling, with cells of the 3D model farther away from the original camera position appearing larger than equally-sized cells closer to the camera.

  2. Inverting the sign of both the X- and the Z-values in the camera’s projection transform by setting the Camera’s UserTransform matrix to an identity matrix, with -1 on both the X and Z:
    -1 0 0 0
    0 1 0 0
    0 0 -1 0
    0 0 0 1
    Inverting the sign of X corrects for the Left-Right flip that results from rotating the camera around the focal point.
    Inverting the sign of Z places the cells cells in the back our 3D model on the front and vice versa. This corrects for the Front-Back flip that results from rotating the camera around the focal point."

Can you explain to me how to do his step #2? I could not find anything called “UserTransform matrix”. Where is this and how can I change it? (I tried changing the “AppliedTransform” matrix in the cameranode and it did not seem to have any effect")

Thank you so much for your help!!

David

In both places you say that you do not need to use reverse perspective for semi-transparent content because you can see through everything so it doesn’t matter what is in front and what is behind. When simulating fluoro images from a volume (or creating a model view to be overlaid on fluoro images) I believe that the reverse perspective is important event for semi-transparent content because the perspective will be wrong.

Reverse perspective is not needed if the model is transparent, because you can simply place the renderer camera in the X-ray source position and all sizes will be correct. The only (very significant) limitation of this approach is that if you use opaque models then you can always just see the side of the objects that face towards the generator. Cutting the surface can help, too (for example for left atrium ablation it can be quite usable), but it depends on the geometry, so not a general solution.

This is a method of the vtkCamera. You can access the VTK camera object as shown in examples in the script repository.