# Marching cubes poly result is scaled

**URL:** <https://discourse.slicer.org/t/marching-cubes-poly-result-is-scaled/4280>\
**Category:** Development\
**Tags:** segmentation\
**Created:** [October 4, 2018, 6:42am UTC](https://discourse.slicer.org/t/marching-cubes-poly-result-is-scaled/4280 "2018-10-04T06:42:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Niels](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@Niels](https://discourse.slicer.org/u/Niels)\
**Post date:** [October 4, 2018, 6:42am UTC](https://discourse.slicer.org/t/marching-cubes-poly-result-is-scaled/4280/1 "2018-10-04T06:42:45Z")

</div>

The result of my poly model coming from is not the same scale as my slices. So I am unable to see them overlap and scroll in the 3Dview. Am I missing an extra step?

```
surface = vtk.vtkMarchingCubes()
surface.SetInputData( imageData )
surface.ReleaseDataFlagOn()
surface.ComputeNormalsOn()
surface.ComputeGradientsOn()
surface.SetValue(0,scalar_iso)
surface.Update()

modelPolyData = surface.GetOutput()
```

---

<div class="post-metadata">

**Author:** ![Niels](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@Niels](https://discourse.slicer.org/u/Niels)\
**Post date:** [October 4, 2018, 9:02am UTC](https://discourse.slicer.org/t/marching-cubes-poly-result-is-scaled/4280/2 "2018-10-04T09:02:02Z")

</div>

The data needed to be transformed to volume space.  
I also happen to find the ModelMaker interface which also suits my needs.

But I am unable to get the points and normals out of a model that was generated by this module. I am using this

[https://discourse.slicer.org/t/access-point-and-cell-data-of-surface-mesh/2426/2](https://discourse.slicer.org/t/access-point-and-cell-data-of-surface-mesh/2426/2)

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [October 4, 2018, 12:57pm UTC](https://discourse.slicer.org/t/marching-cubes-poly-result-is-scaled/4280/3 "2018-10-04T12:57:17Z")

</div>

Once you use Slicer you might want to use its features instead of sticking to VTK programming. If you import your labelmap in a segmentaiton node then convert it to surface then you get good result.

You can do the import from the UI in the Segmentations module or in the Data module (right-click the labelmap). If you want to do it via script or customize it then I’m sure you can find the answer [here in the forum](https://discourse.slicer.org/search?q=import%20labelmap%20to%20segmentation), this is a topic that keeps coming up.

---

<div class="post-metadata">

**Author:** ![Niels](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@Niels](https://discourse.slicer.org/u/Niels)\
**Post date:** [October 8, 2018, 7:52am UTC](https://discourse.slicer.org/t/marching-cubes-poly-result-is-scaled/4280/4 "2018-10-08T07:52:07Z")

</div>

I am now using segmentations in slicer for selecting the voxels of interest and that works perfectly. So that was solved, but I needed the point/normal list to export them to file, I do not need them for anything else. All works fine now. Thanks for your help and link.
