Merging two different segmentations/models

I have surface model along with it’s segmentation to this I want to merge another segmentation which is not in the same segmentation node. Due to this the merge function in segmentation editor model does not work.

Is there a way to either move the segmentation within the other so that the merge operation can take place. Or is there another way to this?

Additionally I would like to process this as a batch operation.

I am unable to attach a screenshot to provide a little more context, if needed I can do so through other image services.

Thanks in advance and a greetings to everyone at the Project week!

I think you can do this by:
1-converting each segmentation into a labelmap
segmentationLblmap = slicer.mrmlScene.AddNewNodeByClass(“vtkMRMLLabelMapVolumeNode”)
slicer.modules.segmentations.logic().ExportVisibleSegmentsToLabelmapNode(segmentationNode, segmentationLblmap, reference_volume_node)
2-getting the array of each segmentation
array1 = slicer.util.arrayFromVolume(segmentationLblmap)
3-do a boolean OR operation between two arrays
arrayOR = np.logical_or(array1.astype(bool), array2.astype(bool)).astype(int)
4- update a labelmap volume from the new array
slicer.util.updateVolumeFromArray(segmentationLblmap, arrayOR)
5- save the labelmap node as a segmentation
slicer.util.saveNode(segmentationLblmap, “d:/…nii.gz”)

Saeed

If the previous answer is not satisfactory to you, can you please tell us more about the exact data objects? It is not clear to me. A screenshot of the Data module would suffice. No need to use an image service, just drag&drop the screenshot here.