RemoveNode does not work to delete a list of node

I have two buttons: Add and Delete. The Add uses to add a node, while the Delete is for node removing. The Add function is implemented as follows:

self.roiNodes =[]
for i in range (10):
    node = slicer.vtkMRMLAnnotationROINode()
    node.SetXYZ(0, 0, 0)
    node.SetRadiusXYZ(25, 25, 25)

The delete function will delete the node base on the seletected row in the table (10 rows)


The add function works well, while the delete function does not work. Any wrong implementation in my code? Thanks

There is no way we can determine where the problem is without seeing all the source code that is involved. If you cannot share tour module’s source code then create a self-contained script that reproduces the unexpected behavior.

Only thing I could guess from your snippet is that the current row in self.node_list.pop(self.table.currentRow()) is no longer the same as the above lines because you removed the table row in the line above.