How to convert CT liver volume to 2d X ray using Drr generation in 3d slicer

Hello, I have doubt about using drr generation in 3d slicer.I am attaching the result I got after using DRR generation. What are the parameters I have to set for proper display of the 2d Xray image in 2d views?.

Have you tried to use DRR Image Computation module which is a also a part of SlicerRT extension? It has an additional markups elements that visualize imager, normal and view-up vectors, but you have to setup a dummy RTplan and RTBeam nodes in order to use that module properly.

Or you cat to use a python script below, where isocenterPosition variable is RAS coordinates of the beam isocenter.

# Create dummy plan
rtImagePlan = slicer.mrmlScene.AddNewNodeByClass( 'vtkMRMLRTPlanNode', 'rtImagePlan')
# Create RTImage dummy beam
rtImageBeam = slicer.mrmlScene.AddNewNodeByClass( 'vtkMRMLRTBeamNode', 'rtImageBeam')
# Set required beam parameters 
rtImageBeam.SetGantryAngle(90.)
rtImageBeam.SetCouchAngle(12.)
# Add beam to the plan
rtImagePlan.AddBeam(rtImageBeam)
# Get CT volume
ctVolume = slicer.mrmlScene.GetFirstNodeByClass('vtkMRMLScalarVolumeNode')
# Set and observe CT volume by the plan
rtImagePlan.SetAndObserveReferenceVolumeNode(ctVolume)

# Set required isocenter position as a point
rtImagePlan.SetIsocenterSpecification(slicer.vtkMRMLRTPlanNode.ArbitraryPoint)
isocenterPosition = [ -1., -2., -3. ]
if (rtImagePlan.SetIsocenterPosition(isocenterPosition)):
  print('New isocenter position is set')

# Create DRR image computation node for user imager parameters
rtImageParameters = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLDrrImageComputationNode', 'rtImageBeamParams')
# Set and observe RTImage beam by the DRR node
rtImageParameters.SetAndObserveBeamNode(rtImageBeam)
# Set required DRR parameters
rtImageParameters.SetHUThresholdBelow(50)
# Get DRR computation logic
drrLogic = slicer.modules.drrimagecomputation.logic()
# Update imager markups for the 3D view and slice views (optional)
drrLogic.UpdateMarkupsNodes(rtImageParameters)
# Update imager normal and view-up vectors (mandatory)
drrLogic.UpdateNormalAndVupVectors(rtImageParameters) # REQUIRED
# Compute DRR image
drrLogic.ComputePlastimatchDRR( rtImageParameters, ctVolume)

After successful DRR image calculation you can click on the Rotate to volume plane button,

image

and when Reset field of view button.