3d 投影到DRR图像平面上的三维点

3d 投影到DRR图像平面上的三维点,3d,geometry,2d,itk,plane,3d,Geometry,2d,Itk,Plane,通过使用vtk工具对其进行体素化,我创建了一个体积网格和相应的3D CT图像。然后,我使用门架角度为0的Siddonjacobray跟踪算法获得了3D CT图像的相应DRR图像 现在我想得到DRR图像投影平面上3D网格的每个顶点坐标对应的2D投影坐标(即x,y位置) 我浏览了AlgirHTML,但它实际上想要输入一个3D CT图像体积并输出DRR图像 如何获得给定3D坐标位置的DRR图像平面中的(x,y)坐标值?例如,我有每个顶点的(x,y,z)位置,我想转换成(x,y),即DRR图像平面上的二

通过使用vtk工具对其进行体素化,我创建了一个体积网格和相应的3D CT图像。然后,我使用门架角度为0的Siddonjacobray跟踪算法获得了3D CT图像的相应DRR图像

现在我想得到DRR图像投影平面上3D网格的每个顶点坐标对应的2D投影坐标(即x,y位置)

我浏览了AlgirHTML,但它实际上想要输入一个3D CT图像体积并输出DRR图像

如何获得给定3D坐标位置的DRR图像平面中的(x,y)坐标值?例如,我有每个顶点的(x,y,z)位置,我想转换成(x,y),即DRR图像平面上的二维投影坐标?你能举例说明吗

我刚刚把C++代码转换成Python版本,以获得给定3D顶点坐标的DRR投影,如下面所见。 但我认为这个插值函数用于将当前体素坐标旋转到检测器坐标系定义的坐标系,因为我获得了三个坐标,即(x,y,z),作为给定3d顶点坐标的输出

m_FocalPointToIsocenterDistance = 1000.; # Focal point to isocenter distance in mm.
m_ProjectionAngle = 0.;                  # Angle in radians betweeen projection central axis and reference axis
m_Threshold = 0.;

TransformType = itk.Euler3DTransform[itk.D]

# user can set an arbitrary transform for the volume. If not explicitly set, it should be identity.
m_Transform = TransformType.New()
m_Transform.SetComputeZYX(True)
m_Transform.SetIdentity()

m_InverseTransform = TransformType.New()
m_InverseTransform.SetComputeZYX(True)
    
m_ComposedTransform = TransformType.New()
m_ComposedTransform.SetComputeZYX(True)

m_GantryRotTransform = TransformType.New()
m_GantryRotTransform.SetComputeZYX(True)
m_GantryRotTransform.SetIdentity()

m_CamShiftTransform = TransformType.New()
m_CamShiftTransform.SetComputeZYX(True)
m_CamShiftTransform.SetIdentity()

m_CamRotTransform = TransformType.New()
m_CamRotTransform.SetComputeZYX(True)
m_CamRotTransform.SetIdentity()
# constant for converting degrees into radians
dtr = (math.atan(1.0) * 4.0) / 180.0
m_CamRotTransform.SetRotation(dtr * (-90.0), 0.0, 0.0)

m_ComposedTransform.SetIdentity()
m_ComposedTransform.Compose(m_Transform, False)

isocenter = m_Transform.GetCenter()
# An Euler 3D transform is used to rotate the volume to simulate the roation of the linac gantry.
# The rotation is about z-axis. After the transform, a AP projection geometry (projecting
# towards positive y direction) is established.
m_GantryRotTransform.SetRotation(0.0, 0.0, -m_ProjectionAngle)
m_GantryRotTransform.SetCenter(isocenter)
m_ComposedTransform.Compose(m_GantryRotTransform, False)

# An Euler 3D transfrom is used to shift the source to the origin.
focalpointtranslation = [None] * 3
focalpointtranslation[0] = -isocenter[0]
focalpointtranslation[1] = m_FocalPointToIsocenterDistance - isocenter[1]
focalpointtranslation[2] = -isocenter[2]

m_CamShiftTransform.SetTranslation(focalpointtranslation)
m_ComposedTransform.Compose(m_CamShiftTransform, False)

# A Euler 3D transform is used to establish the standard negative z-axis projection geometry. (By
# default, the camera is situated at the origin, points down the negative z-axis, and has an up-
# vector of (0, 1, 0).)
m_ComposedTransform.Compose(m_CamRotTransform, False)

# The overall inverse transform is computed. The inverse transform will be used by the interpolation
# procedure.
m_ComposedTransform.GetInverse(m_InverseTransform)

# You probably need to discard one of these 3 coordinates. 
# it should be easier for to figure out which one is depth, and which two are X and Y.
# Coordinate of a DRR pixel in the world coordinate system
drrPixelWorld = m_InverseTransform.TransformPoint(point)