# Get the data from vtkAlgorithmOutput

**URL:** https://discourse.vtk.org/t/get-the-data-from-vtkalgorithmoutput/10252
**Category:** Support
**Created:** [December 19, 2022, 6:12pm UTC](https://discourse.vtk.org/t/get-the-data-from-vtkalgorithmoutput/10252 "2022-12-19T18:12:17Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Neo](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/n/9fc348/32.png) [@Neo](https://discourse.vtk.org/u/Neo)
#### Post date: [December 19, 2022, 6:12pm UTC](https://discourse.vtk.org/t/get-the-data-from-vtkalgorithmoutput/10252/1 "2022-12-19T18:12:17Z")

</div>

I applied the marching cubes algorithm on a volume. The output is a vtkAlgorithmOutput (output\_port variable) as shown by the following code. I want to extract the actual points (locations inside the volume coordinates) of the different iso-surfaces obtained by the marching cubes algorithms. Could you please help me as I want to apply some processing on these iso-surfaces? Any language is acceptable.

```
surface = vtkMarchingCubes()
surface.SetInputData(volume)
surface.ComputeNormalsOn()
surface.SetValue(0, 255)
output_port = surface.GetOutputPort()

```

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 20, 2022, 11:04am UTC](https://discourse.vtk.org/t/get-the-data-from-vtkalgorithmoutput/10252/2 "2022-12-20T11:04:57Z")

</div>

Hello,

`vtkMarchingCubes` is a `vtkPolyDataAlorithm` subclass: [https://vtk.org/doc/nightly/html/classvtkPolyDataAlgorithm.html](https://vtk.org/doc/nightly/html/classvtkPolyDataAlgorithm.html) . Hence, it has a `GetOutput()` method which returns a pointer to an usable `vtkPolyData` object. `GetOutputPort()` is just a plug to make up processing pipelines by joining several algorithms and filters.

take care,

Paulo

---

<div class="post-metadata">

### Author: ![Neo](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/n/9fc348/32.png) [@Neo](https://discourse.vtk.org/u/Neo)
#### Post date: [December 20, 2022, 3:43pm UTC](https://discourse.vtk.org/t/get-the-data-from-vtkalgorithmoutput/10252/3 "2022-12-20T15:43:27Z")

</div>

Thank you, Paulo,  
I was able to save the vtkPolyData object using vtkXMLPolyDataWriter to make some processing on the iso-surfaces. Is there a better way to save the data?

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 20, 2022, 8:16pm UTC](https://discourse.vtk.org/t/get-the-data-from-vtkalgorithmoutput/10252/4 "2022-12-20T20:16:52Z")

</div>

Better in what sense? I mean, if you seek portability, saving to XML is a good choice. If you want to minimize file size, you can use `vtkPolyDataWriter` which persists objects in a proprietary binary or ASCII format (`*.vtk`).
