[Rtk-users] CT forward projection image quality
Timothy Wang Bok Yau
tyau5 at uwo.ca
Tue Sep 10 18:11:12 CEST 2024
Hi everyone,
I recently started using rtk to generate DRRs and was hoping to receive some insight on how to improve the quality of a DRR generated from a patient CT. I am hoping that the DRR would be able to approximate the quality of a kV projection from a cone beam CT. Currently I am setting the projection parameters to match the kV acquisition parameters on our linear accelerators, but am finding that the DRRs I produce are very blurry with low contrast. I was able to find some studies in the literature using rtk to generate DRRs and have found that their image quality is significantly better than what I am currently achieving (see Fig. 1 from the following paper https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4833659/). I've copied my code for generating the DRRs. Any insight would be greatly appreciated.
# Read CT in from DICOM files
dirName = r"C:\Users\yaut\CT"
namesGenerator = itk.GDCMSeriesFileNames.New()
namesGenerator.SetUseSeriesDetails(True)
namesGenerator.AddSeriesRestriction("0008|0021")
namesGenerator.SetGlobalWarningDisplay(False)
namesGenerator.SetDirectory(dirName)
uid = namesGenerator.GetSeriesUIDs()[0]
fileNames = namesGenerator.GetFileNames(uid)
# Setup the image series reader using GDCMImageIO
ImageType = itk.Image[itk.F,3]
reader = itk.ImageSeriesReader[ImageType].New()
dicomIO = itk.GDCMImageIO.New()
reader.SetImageIO(dicomIO)
reader.SetFileNames(fileNames)
reader.ForceOrthogonalDirectionOff()
# Read DICOM
reader.Update()
CT = reader.GetOutput()
# change the direction and origin to align with the RTK convention
CTDirection = np.array([[0.,1.,0.],[0.,0.,1.],[-1.,0.,0.]])
CT.SetDirection(itk.matrix_from_array(CTDirection))
# Center the image around 0 which is the default center of rotation
CT.SetOrigin([-0.5*(CT.GetLargestPossibleRegion().GetSize()[1]-1)*CT.GetSpacing()[1],
-0.5*(CT.GetLargestPossibleRegion().GetSize()[2]-1)*CT.GetSpacing()[2],
0.5*(CT.GetLargestPossibleRegion().GetSize()[0]-1)*CT.GetSpacing()[0]])
# Set forward projection geometry
geometry = rtk.ThreeDCircularProjectionGeometry.New()
# Image type
ImageType = itk.Image[itk.F,3]
# Image geometry
geometry = rtk.ThreeDCircularProjectionGeometry.New()
numberOfProjections = 360
firstAngle = 0
angularArc = 2*np.pi
# Source to isocentre distance in mm
sid = 1000
# Source to detector distance in mm
sdd = 1500
for x in range(0,numberOfProjections):
angle = firstAngle + x*angularArc/numberOfProjections
geometry.AddProjectionInRadians(sid,sdd,angle,inPlaneAngle=np.pi)
# Create a stack of empty projection images
# Spacing and output size are set based on kV acquisition parameters on our Linacs
ConstantImageSourceType = rtk.ConstantImageSource[ImageType]
constantImageSource = ConstantImageSourceType.New()
origin = CT.GetOrigin()
sizeOutput = [1024, 1024, numberOfProjections ]
spacing = [0.388, 0.388, 0.5] #mm
constantImageSource.SetOrigin( origin )
constantImageSource.SetSpacing( spacing )
constantImageSource.SetSize( sizeOutput )
constantImageSource.SetConstant(0.)
# Generate DRRs
JosephType = rtk.JosephForwardProjectionImageFilter[ImageType, ImageType]
joseph = JosephType.New()
joseph.SetGeometry(geometry)
joseph.SetInput(constantImageSource.GetOutput())
joseph.SetInput(1, CT)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20240910/f7c361f8/attachment-0001.htm>
More information about the Rtk-users
mailing list