Unable to export segment with ExportSegmentsClosedSurfaceRepresentationToFiles

Xabierenko
Tue, 03 May 2022 18:31:30 +0000
Support

Hi,

I have been using the code snippet below to export large amounts of segmentations to .stl format.

segmentation = slicer.util.loadSegmentation(seg)
vol = slicer.util.loadVolume(mag)

volumeNode = slicer.util.getNode('*magnitude*')  # Get the volume node
segNode = slicer.util.getNode('*Segment*')
    slicer.vtkSlicerSegmentationsModuleLogic.ExportSegmentsClosedSurfaceRepresentationToFiles(out, segNode, None, "STL", False, 0.001, False)

slicer.mrmlScene.RemoveNode(volumeNode)
slicer.mrmlScene.RemoveNode(segmentation)

I don’t know why when I’m trying the same code to export a new dataset I’m getting the following error.

TypeError: ExportSegmentsClosedSurfaceRepresentationToFiles argument 2: method requires a vtkMRMLSegmentationNode, a vtkMRMLSegmentationStorageNode was provided.

Kind regards,
Xabier

5 posts - 4 participants