# How to make a point cloud data from DICOM Series?

**URL:** https://discourse.vtk.org/t/how-to-make-a-point-cloud-data-from-dicom-series/9505
**Category:** Support
**Created:** [September 30, 2022, 11:22am UTC](https://discourse.vtk.org/t/how-to-make-a-point-cloud-data-from-dicom-series/9505 "2022-09-30T11:22:13Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Kim\_William](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kim_william/32/373_2.png) [@Kim\_William](https://discourse.vtk.org/u/Kim_William)
#### Post date: [September 30, 2022, 11:22am UTC](https://discourse.vtk.org/t/how-to-make-a-point-cloud-data-from-dicom-series/9505/1 "2022-09-30T11:22:13Z")

</div>

Hi all.

I’m using the 3D Slicer program. As far as I know, this program was based on the VTK library.

The below image is a screenshot of the 3D Slicer program UI.

 ![image](https://discourse.vtk.org/uploads/default/original/2X/4/4d69ece367b92639321d65f0938c0a35ad239299.jpeg)

I used DICOM images from the VTK ReadDICOMSeries example.

So, my question is… how to make a point cloud data from DICOM series.  
Such like right upper image.

Is it possible to make a point cloud data from DICOM series using the VTK library?  
If yes, could you please let me know the C++ example code?

Thank you!

---

<div class="post-metadata">

### Author: ![spyridon97](https://discourse.vtk.org/user_avatar/discourse.vtk.org/spyridon97/32/7069_2.png) [@spyridon97](https://discourse.vtk.org/u/spyridon97)
#### Post date: [October 1, 2022, 12:37am UTC](https://discourse.vtk.org/t/how-to-make-a-point-cloud-data-from-dicom-series/9505/2 "2022-10-01T00:37:07Z")

</div>

You can check the [vtkConvertToPointCloud](https://vtk.org/doc/nightly/html/classvtkConvertToPointCloud.html) Filter. I hope that helps

---

<div class="post-metadata">

### Author: ![Kim\_William](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kim_william/32/373_2.png) [@Kim\_William](https://discourse.vtk.org/u/Kim_William)
#### Post date: [October 1, 2022, 3:04am UTC](https://discourse.vtk.org/t/how-to-make-a-point-cloud-data-from-dicom-series/9505/3 "2022-10-01T03:04:33Z")

</div>

Thank you for your reply.  
but… could you please explain detail? 😢

I tried to read DICOM files and convert to PCD, using as the below code:

```auto
vtkNew<vtkDICOMImageReader> reader;
reader->SetDirectoryName(folder.c_str());
reader->Update();

vtkNew<vtkConvertToPointCloud> cvtPcd;
cvtPcd->AddInputConnection(reader->GetOutputPort());
cvtPcd->Update();

```

And using the below example code:  
[https://kitware.github.io/vtk-examples/site/Cxx/Points/ExtractSurfaceDemo/](https://kitware.github.io/vtk-examples/site/Cxx/Points/ExtractSurfaceDemo/)

```auto
//auto polyData = ReadPolyData(argc > 1 ? argv[1] : "");
auto polyData = cvtPcd->GetOutput();
//except above line, all the code the same.

```

This is my result…

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

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [October 3, 2022, 1:25pm UTC](https://discourse.vtk.org/t/how-to-make-a-point-cloud-data-from-dicom-series/9505/4 "2022-10-03T13:25:40Z")

</div>

The image in the upper right looks like a volume rendering. Please take a look at VTK’s [Volume Rendering examples](https://kitware.github.io/vtk-examples/site/Cxx/#volume-rendering) to learn more.

---

<div class="post-metadata">

### Author: ![spyridon97](https://discourse.vtk.org/user_avatar/discourse.vtk.org/spyridon97/32/7069_2.png) [@spyridon97](https://discourse.vtk.org/u/spyridon97)
#### Post date: [October 6, 2022, 2:13pm UTC](https://discourse.vtk.org/t/how-to-make-a-point-cloud-data-from-dicom-series/9505/5 "2022-10-06T14:13:16Z")

</div>

Do you want to get a point cloud out of the image and color it using your image scalar values? or do you want to volume render your image?

---

<div class="post-metadata">

### Author: ![Kim\_William](https://discourse.vtk.org/user_avatar/discourse.vtk.org/kim_william/32/373_2.png) [@Kim\_William](https://discourse.vtk.org/u/Kim_William)
#### Post date: [October 9, 2022, 8:51am UTC](https://discourse.vtk.org/t/how-to-make-a-point-cloud-data-from-dicom-series/9505/6 "2022-10-09T08:51:47Z")

</div>

Hi all. Thank you for your help.  
I’m sorry for my late reply.

I found that the sample code is already exist what I want.

[https://kitware.github.io/vtk-examples/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT/](https://kitware.github.io/vtk-examples/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT/)

It worked well for me.

Thank you!
