# Convert planar contour to ribbon model in code

**URL:** <https://discourse.slicer.org/t/convert-planar-contour-to-ribbon-model-in-code/34119>\
**Category:** Support\
**Tags:** segmentation, python\
**Created:** [February 2, 2024, 12:07pm UTC](https://discourse.slicer.org/t/convert-planar-contour-to-ribbon-model-in-code/34119 "2024-02-02T12:07:08Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![susk](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@susk](https://discourse.slicer.org/u/susk)\
**Post date:** [February 5, 2024, 11:17am UTC](https://discourse.slicer.org/t/convert-planar-contour-to-ribbon-model-in-code/34119/2 "2024-02-05T11:17:18Z")

</div>

I found the solution, it was very simple. In case anyone is interested:  
segmentationNode = getNode(“Segmentation”)  
segmentationNode.GetSegmentation().CreateRepresentation(“Ribbon model”)

This will create a representation in all segments, using the conversion path with the lowest cost. Conversion starts from the master representation, which in my case was “Planar contour”

---

_[View the full topic](https://discourse.slicer.org/t/convert-planar-contour-to-ribbon-model-in-code/34119)._
