# 3D reconstruction of an object from slices in cylindrical coordinate system

**URL:** https://discourse.vtk.org/t/3d-reconstruction-of-an-object-from-slices-in-cylindrical-coordinate-system/13684
**Category:** Support
**Created:** [April 10, 2024, 9:04am UTC](https://discourse.vtk.org/t/3d-reconstruction-of-an-object-from-slices-in-cylindrical-coordinate-system/13684 "2024-04-10T09:04:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Viktor\_Sokolov](https://discourse.vtk.org/user_avatar/discourse.vtk.org/viktor_sokolov/32/8715_2.png) [@Viktor\_Sokolov](https://discourse.vtk.org/u/Viktor_Sokolov)
#### Post date: [April 10, 2024, 9:04am UTC](https://discourse.vtk.org/t/3d-reconstruction-of-an-object-from-slices-in-cylindrical-coordinate-system/13684/1 "2024-04-10T09:04:02Z")

</div>

Hello everyone! I want to reconstruct a pyramid from its slices stored in .jpeg images in order to test 3D reconstruction algorithms and familiarize myself with the VTK library. I’ve read the main chapters of the VTK book and understand the basic library architecture. I have a difficulty in how to load and arrange my 3D slices; I see my visualization workflow as follows: Data (Slices) → (Preprocessing step) → vtkMarchingCubes → vtkPolyDataMapper() → vtkActor() → vtkRenderer(). Can you help me with the preprocessing step? I only have seen examples for parallel slices from medical images in DICOM format.

 ![Screenshot (156)](https://discourse.vtk.org/uploads/default/original/2X/b/be4474cf693fb7728fbbad0721cf7dbd2cc81e36.png)

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [April 10, 2024, 1:36pm UTC](https://discourse.vtk.org/t/3d-reconstruction-of-an-object-from-slices-in-cylindrical-coordinate-system/13684/2 "2024-04-10T13:36:12Z")

</div>

If your slices are essentially pixel data, your output of reconstruction should be of type `vtkImageData`.

If your slices were in the cartesian coordinate system, all you have to do is stack them up in a vtkImageData along the Z-dimension. In the case of a cylindrical coordinate system, you’d have to come up with the transformation yourself. Note that vtkImageData is axis-aligned.

---

<div class="post-metadata">

### Author: ![Viktor\_Sokolov](https://discourse.vtk.org/user_avatar/discourse.vtk.org/viktor_sokolov/32/8715_2.png) [@Viktor\_Sokolov](https://discourse.vtk.org/u/Viktor_Sokolov)
#### Post date: [April 11, 2024, 1:14pm UTC](https://discourse.vtk.org/t/3d-reconstruction-of-an-object-from-slices-in-cylindrical-coordinate-system/13684/3 "2024-04-11T13:14:13Z")

</div>

I meant that my slices are arranged as in the picture and they are not parallel to each other, and I am not sure what VTK data structure should I use to arrange them this way before passing to vtkMarchingCubes algorithm.  
 ![360px-Coord_system_CY_1.svg](https://discourse.vtk.org/uploads/default/original/2X/4/4576517ae989acafc3b2b0a3fbed96656da7cff1.png)

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [April 12, 2024, 7:27pm UTC](https://discourse.vtk.org/t/3d-reconstruction-of-an-object-from-slices-in-cylindrical-coordinate-system/13684/4 "2024-04-12T19:27:54Z")

</div>

I see. In that case, you’d have to implement a custom vtkImageAlgorithm that populates the voxel intensities in the output volume by probing the input slices. I don’t believe something like this exists currently in VTK.
