# Create a mesh in python script

**URL:** <https://discourse.slicer.org/t/create-a-mesh-in-python-script/1543>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [November 28, 2017, 4:31pm UTC](https://discourse.slicer.org/t/create-a-mesh-in-python-script/1543 "2017-11-28T16:31:56Z")\
**Posts on this page:** 1\
**Showing post:** 36

<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:** [April 10, 2018, 1:47pm UTC](https://discourse.slicer.org/t/create-a-mesh-in-python-script/1543/36 "2018-04-10T13:47:05Z")

</div>

You can use the Segment Statistics module to do that. See for example

> [@Using segmentstatistics module in python script](https://discourse.slicer.org/t/using-segmentstatistics-module-in-python-script/2140):
>
> Dear all, How can I call and use segmentstatistics module in a simple way. I tried this code but I get an error volSeg = slicer.util.getNode('Segmentation') volInput = self.inputSelector.currentNode() segStat = slicer.modules.segmentstatistics.widgetRepresentation().self() segStat.grayscaleNode = volInput segStat.labelNode = volSeg segStat.onApply() segStat.onExportToTable() segTbl = slicer.util.getNode('Segmentation statistics\*') This is the error: S…

---

_[View the full topic](https://discourse.slicer.org/t/create-a-mesh-in-python-script/1543)._
