# make segmentation labelmap from markupsclosedcurve

**URL:** <https://discourse.slicer.org/t/make-segmentation-labelmap-from-markupsclosedcurve/14103>\
**Category:** Support\
**Tags:** segmentation, python\
**Created:** [October 17, 2020, 6:33pm UTC](https://discourse.slicer.org/t/make-segmentation-labelmap-from-markupsclosedcurve/14103 "2020-10-17T18:33:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![doebow](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/doebow/32/8483_2.png) [@doebow](https://discourse.slicer.org/u/doebow)\
**Post date:** [October 17, 2020, 6:33pm UTC](https://discourse.slicer.org/t/make-segmentation-labelmap-from-markupsclosedcurve/14103/1 "2020-10-17T18:33:17Z")

</div>

slicer version: 4.11.10

I’m trying to make a binary label mask from a closed curve markup. Here is my code

curves=slicer.util.getNodesByClass(“vtkMRMLMarkupsClosedCurveNode”)  
areaMm2 = slicer.modules.markups.logic().GetClosedCurveSurfaceArea(curves[0], crossSectionSurface)  
modelNode = slicer.modules.models.logic().AddModel(crossSectionSurface)

inputModel=getNode(“Model\_1”)  
referenceVolumeNode=getNode(“1: No series description\_1”)  
seg = slicer.mrmlScene.AddNewNodeByClass(‘vtkMRMLSegmentationNode’)  
seg.SetReferenceImageGeometryParameterFromVolumeNode(referenceVolumeNode)  
slicer.modules.segmentations.logic().ImportModelToSegmentationNode(inputModel, seg)  
seg.CreateBinaryLabelmapRepresentation()

outputLabelmapVolumeNode = slicer.mrmlScene.AddNewNodeByClass(‘vtkMRMLLabelMapVolumeNode’)  
slicer.modules.segmentations.logic().ExportVisibleSegmentsToLabelmapNode(seg, outputLabelmapVolumeNode, referenceVolumeNode)  
outputLabelmapVolumeArray = (slicer.util.arrayFromVolume(outputLabelmapVolumeNode) \* 100).astype(‘int8’)

Here is what I get

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/f/dfb6636ae92c64684df9ed7a26d735d2e6d19ebe.jpeg)

I can only see the segmentation in 3D view however I couldn’t see it in other view and also the lablemap is empty.  
I think it is because the segmentation is closed surface representation not binary labelmap representation. Nevertheless I couldn’t get binary labelmap representation though this code seg.CreateBinaryLabelmapRepresentation()  
How can I fix it?
