# Algorithm to Convert a CT Image to an X-ray image

**URL:** https://discourse.vtk.org/t/algorithm-to-convert-a-ct-image-to-an-x-ray-image/2726
**Category:** Support
**Created:** [February 28, 2020, 11:54pm UTC](https://discourse.vtk.org/t/algorithm-to-convert-a-ct-image-to-an-x-ray-image/2726 "2020-02-28T23:54:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Uncheajax](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/u/46a35a/32.png) [@Uncheajax](https://discourse.vtk.org/u/Uncheajax)
#### Post date: [February 28, 2020, 11:54pm UTC](https://discourse.vtk.org/t/algorithm-to-convert-a-ct-image-to-an-x-ray-image/2726/1 "2020-02-28T23:54:54Z")

</div>

Hello,  
Can someone assist with the steps or algorithm to convert a CT image to an X-ray image.

---

<div class="post-metadata">

### Author: ![estan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/estan/32/460_2.png) [@estan](https://discourse.vtk.org/u/estan)
#### Post date: [February 29, 2020, 12:00pm UTC](https://discourse.vtk.org/t/algorithm-to-convert-a-ct-image-to-an-x-ray-image/2726/2 "2020-02-29T12:00:20Z")

</div>

Hi,

It’s not entirely clear what you mean by that. Do you have a computed tomography volume (so a 3D dataset) that you wish to render as a 2D image from some angle on screen or to a 2D image on disk? If so, have a look at VTK’s volume mappers.

Please explain a bit more what your input data looks like, and what your objective is, and we can better help you.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [March 1, 2020, 2:03pm UTC](https://discourse.vtk.org/t/algorithm-to-convert-a-ct-image-to-an-x-ray-image/2726/3 "2020-03-01T14:03:59Z")

</div>

There are two main approaches. For applications where speed is the most important, you can generate X-ray (DRR) using volume rendering (volume raycast mapper). If execution time is not a concern and you need dynamic range more than 8 bits)then you can use VTK image reslice filter in thick slab mode.

See discussion of suitable volume rendering presets [here](https://discourse.slicer.org/t/is-it-possible-to-change-a-cbct-to-2d-x-ray-image/7617/5?u=lassoan). You can find example of setting up reslice filter to generate DRR [here](https://discourse.slicer.org/t/generate-2d-x-ray-image-from-volume-just-like-drr/976).
