# How to get correct mask value from one segment from Segment Editor?

**URL:** <https://discourse.slicer.org/t/how-to-get-correct-mask-value-from-one-segment-from-segment-editor/1895>\
**Category:** Support\
**Created:** [January 22, 2018, 7:23am UTC](https://discourse.slicer.org/t/how-to-get-correct-mask-value-from-one-segment-from-segment-editor/1895 "2018-01-22T07:23:34Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![spring](https://avatars.discourse-cdn.com/v4/letter/s/ee59a6/32.png) [@spring](https://discourse.slicer.org/u/spring)\
**Post date:** [January 24, 2018, 3:17am UTC](https://discourse.slicer.org/t/how-to-get-correct-mask-value-from-one-segment-from-segment-editor/1895/9 "2018-01-24T03:17:39Z")

</div>

Hi Lassoan,

```
Below is some updates.

"You can edit segmentations in Segment Editor module with various tools. Is there some operation that you cannot do in the Segment Editor?"

```

[Yes,we want to save the modified masks into a json file which can be inputted as a argument when computing Radiomics by a exe file;]

```
"Why do you create polydata manually? Segmentation node can provide you closed surface representation as shown here."

```

[This polydata = vtk.vtkMarchingCubes().GetOutput(),will be used to modelNode.SetAndObservePolyData(polydata) ,then loaded into segmentationNode by ImportModelToSegmentationNode(modelNode, segmentationNode).]

```
"You still have the binary labelmap representation in the segmentation. Why do you import the segment?"

```

[I am not sure when this binary labelmap representation has been [created.In](http://created.In) our logic,this binary labelmap representation was got from segmentationNode.GetBinaryLabelmapRepresentation(segmentID) at last step,since we have to get each segment’s mask after all of segments have been added,and save those masks into json file.Pls correct me if I am wrong.]

```
"if you use vtkDiscreteMarchingCubes then it should be possible to convert without losing information, but the result is just a cube for each voxel, so the vtkDiscreteMarchingCubes output is not usable for much."

```

[We have changed to this method: create a vtkImageData to save mask values firstly–\>then convert it to vtkOrientedImageData–\>ImportLabelmapToSegmentationNode(vtkOrientedImageData, segmentationNode)–\>segmentationNode.GetBinaryLabelmapRepresentation(eachSegmentID)—\>Output masks.  
And the result (mask value) is same with original one.]

Thanks，  
Chunbo

---

_[View the full topic](https://discourse.slicer.org/t/how-to-get-correct-mask-value-from-one-segment-from-segment-editor/1895)._
