# How to convert a model to a segment?

**URL:** <https://discourse.slicer.org/t/how-to-convert-a-model-to-a-segment/27225>\
**Category:** Support\
**Created:** [January 13, 2023, 11:54am UTC](https://discourse.slicer.org/t/how-to-convert-a-model-to-a-segment/27225 "2023-01-13T11:54:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Caetox](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/caetox/32/17513_2.png) [@Caetox](https://discourse.slicer.org/u/Caetox)\
**Post date:** [January 13, 2023, 11:54am UTC](https://discourse.slicer.org/t/how-to-convert-a-model-to-a-segment/27225/1 "2023-01-13T11:54:44Z")

</div>

I want to convert a model to a segment.  
I tried using the CreateSegmentFromModelNode Function from the slicer.modules.segmentations.logic(). It returns a segment, but how can I then add it to a segmentation?

```auto
        modelNode = slicer.util.getNode('Model')
        segmentationNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLSegmentationNode', 'CurveSegmentation')

        # Get the segmentation logic
        segmentationLogic = slicer.modules.segmentations.logic()

        # Convert the model to a segment
        segmentID = segmentationLogic.CreateSegmentFromModelNode(modelNode, segmentationNode)

```
