Generate 2D X-ray image from volume, just like DRR

I’m finding a way to generate 2D X-ray image from volume data, just like what DRR does.
Is there any extension which can do this?Or can I do it in a python way?


Probably the easiest way to get DRR-like images is to set up thick slice display using Python. For example, copy-paste this code snippets into the Python console to get started:

Maximum intensity projection:

sliceNode = slicer.mrmlScene.GetNodeByID('vtkMRMLSliceNodeRed')
appLogic =
sliceLogic = appLogic.GetSliceLogic(sliceNode)
sliceLayerLogic = sliceLogic.GetBackgroundLayer()
reslice = sliceLayerLogic.GetReslice()

Result for CTChest example data set:


You could get more DRR-like image if you change slab mode to mean instead of max (reslice.SetSlabModeToMean()), but usually it makes details more difficult to see.

Same data set with DRR-like mean slab mode:


See some more examples here.

For faster updates and display in 3D view, you can configure Volume rendering module to show a maximum intensity projection (MIP). For most realistic DRR rendering, you can try to use Plastimatch extension.

1 Like

Hi, Andras

Thanks a lot for your reply! I tried it and find it very helpful for me.But in slicer 4.6.0, there is no content in plastimatch module.Perhaps it’s a problem about version.

thanks again