[Rtk-users] DRR from 3d CT and projection of lung contour mesh onto it
qod rec
recqod at gmail.com
Fri Sep 23 00:52:59 UTC 2022
Hello!
I have some 3d chest CTs and its lung contour is labeled. I generate the
contour meshes and want to project their vertices (points) onto the DRR.
I use the following parameters to generate DRR using
JosephForwardProjectionImageFilter in RTK.
# Input
inputVolume = itk.imread('chest.nii')
inputVolume = inputVolume.astype(itk.F)
volumeSpacing = inputVolume.GetSpacing()
volumeOrigin = inputVolume.GetOrigin()
volumeDirection = inputVolume.GetDirection()
volumeShape = inputVolume.shape
volumeDirection = itk.array_from_matrix(volumeDirection)
print(volumeSpacing)
print(volumeOrigin)
print(volumeDirection)
print(volumeShape)
itkVectorD3 ([0.810547, 0.810547, 1])
itkPointD3 ([-213.107, 206.892, -220.053])
[[ 1. 0. 0.]
[ 0. -1. 0.]
[ 0. 0. 1.]]
(301, 512, 512)
# Geometry
geometry = rtk.ThreeDCircularProjectionGeometry.New()
numberOfProjections = 1
sid = 10000 # source to isocenter distance
sdd = 20000 # source to detector distance
gantryAngle = 0. # rot around y-axis
projOffsetX = 0.
projOffsetY = 0.
outOfPlaneAngle = 90. # rot around x-axis
inPlaneAngle = 0. # rot around z-axis
sourceOffsetX = 0.
sourceOffsetY = 0.
geometry.AddProjection(sid, sdd, gantryAngle, projOffsetX, projOffsetY,
outOfPlaneAngle, inPlaneAngle, sourceOffsetX, sourceOffsetY)
# Create a stack of empty projection images
ConstantImageSourceType = rtk.ConstantImageSource[OutputImageType]
constantImageSource = ConstantImageSourceType.New()
origin = [-511, -511, 0]
sizeOutput = [512, 512, 1]
spacing = [2, 2, 1]
constantImageSource.SetOrigin(origin)
constantImageSource.SetSpacing(spacing)
constantImageSource.SetSize(sizeOutput)
constantImageSource.SetConstant(0.)
Finally I get this DRR looks like a front-view one:
[image: image.png]
Here are my questions:
1. I thought I would get a 512x512 full DRR with no backgrounds, just like
normal x-ray, how can I fix it?
2. What's the meaning of constantImageSource's parameters? If I set these
origin, spacing and size just like my input volume, I got DRR nowhere or
too big to display.
3. I have read the geometry doc, and my understanding about its projection
matrix is that the matrix is a translation matrix multiply rotation matrix.
Since it is a 3x4 matrix, if I multiply a 3d point in homogeneous
coordinates, the point will be project to a 2d point, right? What is the 2d
coordinate? What coordinate system should I multiply the projection matrix
on? Physical coordinate or Voxel coordinate?
Thank you so much for reading and answering my long-winded questions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20220923/e2c367c9/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 73788 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20220923/e2c367c9/attachment-0001.png>
More information about the Rtk-users
mailing list