[Rtk-users] CT forward projection image quality

Simon Rit simon.rit at creatis.insa-lyon.fr
Wed Sep 11 09:09:15 CEST 2024


Hi Timothy,
The contrast and the spatial resolution mostly depends on the spatial
resolution of the CT image you are projecting. I don't think you can do
better with Joseph's projector.
Regarding contrast, you might want to apply the Beer Lambert law (opposite
then exponential) to have something more similar to a kV projection (up to
a multiplicative constant probably).
I have BCCed Andy Shieh (first author of your reference) in case he has
something else to suggest.
I hope it helps,
Simon

On Tue, Sep 10, 2024 at 6:12 PM Timothy Wang Bok Yau <tyau5 at uwo.ca> wrote:

> 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)
>
>
> _______________________________________________
> Rtk-users mailing list
> rtk-users at openrtk.org
> https://www.creatis.insa-lyon.fr/mailman/listinfo/rtk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.creatis.insa-lyon.fr/pipermail/rtk-users/attachments/20240911/ce6ccfd6/attachment.htm>


More information about the Rtk-users mailing list