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

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 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