# Could VTK be used to re-construct colorful 3D using colorful CT images?

**URL:** https://discourse.vtk.org/t/could-vtk-be-used-to-re-construct-colorful-3d-using-colorful-ct-images/4605
**Category:** Development
**Created:** [November 9, 2020, 1:08am UTC](https://discourse.vtk.org/t/could-vtk-be-used-to-re-construct-colorful-3d-using-colorful-ct-images/4605 "2020-11-09T01:08:20Z")
**Posts on this page:** 1
**Showing post:** 12

<div class="post-metadata">

### Author: ![Gresliebear](https://discourse.vtk.org/user_avatar/discourse.vtk.org/gresliebear/32/2601_2.png) [@Gresliebear](https://discourse.vtk.org/u/Gresliebear)
#### Post date: [November 10, 2020, 8:01pm UTC](https://discourse.vtk.org/t/could-vtk-be-used-to-re-construct-colorful-3d-using-colorful-ct-images/4605/12 "2020-11-10T20:01:41Z")

</div>

> [@Numpy 3D array into VTK data types for volume rendering?](https://discourse.vtk.org/t/numpy-3d-array-into-vtk-data-types-for-volume-rendering/3455):
>
> Hi, everyone I am attempting to convert 3D numpy array into volume rendering function in pythonVTK or C++ code of VTK. Data type conversion of numpy array data into 3D volumes is an issue for me, I cant seem to find an alternative to file formats or conversion to data file formats of VTK itself.

We have tried to volume render CT scans or DICOM files by going directly to numpy arrays and using pyvista. pyvista is python wrappings on top of C++ of VTK. Long term I think its better just learn C++ and make it work but for prototyping its possibly to accomplish.

![image](https://discourse.vtk.org/uploads/default/original/2X/1/1f9e6725b2673c40abadec18686814a56fe3fc52.png)

We have had success but there is still a lot of development required, I think to make the conversion of CT scans to 3D objects.

```
def displayer(numpy_mask):
  data_matrix = numpy_mask
  opacity = [0, 0, 0, 4, 8, 0, 0] 
  data = pv.wrap(data_matrix)

  pv.set_plot_theme("night")
  #print(type(data)) #pyvista.core.grid.UniformGrid'
  #print(dir(data)) #x = pickle.dumps(data) #print(x)
  #print(BytesIO(data))
  return data

```

if you ever want to talk [lesliemwubbel@gmail.com](mailto:lesliemwubbel@gmail.com)

---

_[View the full topic](https://discourse.vtk.org/t/could-vtk-be-used-to-re-construct-colorful-3d-using-colorful-ct-images/4605)._
