[Rtk-users] DRR from 3d CT and projection of lung contour mesh onto it

Simon Rit simon.rit at creatis.insa-lyon.fr
Fri Sep 23 15:17:13 CEST 2022


Hi qod rec,
1. The projection is limited by the size of your input volumes. With such a
large source to object distance (10 m), you're almost parallel so what you
see should correspond to the size of a coronal slice of your volume.
2. constantImageSource creates an image (here filled with the constant
value 0). The meaning is described in the ITK software guide, figure 4.1
<https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch4.html#x45-54001r1>.
Your input image has a negative spacing which is transferred to the
direction matrix.
3. There is also a projection matrix. So you mutiply a 3D point in
homogenous coordinates (4 values x y z 1) you get a 2 2d point in
homogenous coordinates (3 values u v w). your coordinate is u/w and v/w. It
works in physical coordinates.
Simon

On Fri, Sep 23, 2022 at 2:53 AM qod rec <recqod at gmail.com> wrote:

> 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.
>
> _______________________________________________
> Rtk-users mailing list
> Rtk-users at public.kitware.com
> https://public.kitware.com/cgi-bin/mailman/listinfo/rtk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20220923/70522598/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 73788 bytes
Desc: not available
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20220923/70522598/attachment.png>


More information about the Rtk-users mailing list