Calculate angle between oriented bounding boxes

Operating system : Win10 x64:
Slicer version : 4.11.20200930

I’m a medical doctor and fairly new to the slicer 3d application, I am trying to calculate the angles between oriented bounding boxes created with the python code here

I tried to use the segment statistics module for this task but cannot fully understand how to use the data provided. What i need is a simple solution like the angle planes module since i’ll be dealing with huge amount of calculations. Thanks for your patience…

obb_direction_ras_x, obb_direction_ras_y, and obb_direction_ras_z are vectors specifying direction of coordinate system axes. You can get angles between vectors using standard vector math, but you can also use convenience functions in VTK, for example:

v1 = box1_obb_direction_ras_x
v2 = box2_obb_direction_ras_x
box1_box2_x_angle = vtk.vtkMath.DegreesFromRadians(vtk.vtkMath.AngleBetweenVectors(v1, v2))
1 Like

Thank you for quick reply. I have managed to measure the vector angles as you described but was unable to produce accurate reproducible results. I need to measure a specific angle for each OBB like this one

Actually it’s the angle between the central planes of each OBB would you please point me to the right direction?. Thanks in advance…