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

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 = slicer.app.applicationLogic()
sliceLogic = appLogic.GetSliceLogic(sliceNode)
sliceLayerLogic = sliceLogic.GetBackgroundLayer()
reslice = sliceLayerLogic.GetReslice()
reslice.SetSlabModeToMax()
reslice.SetSlabNumberOfSlices(600)
reslice.SetSlabSliceSpacingFraction(0.5)
sliceNode.Modified()

Result for CTChest example data set:

image_00036

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:

image_00035

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