Hi,
I have been developing a extension where I need to select multiple points and then based on an algorithm transforming the volume. For this purpose, I have used qSlicerSimpleMarkupsWidget() and qSlicerMarkupsPlaceWidget. The algorithm is working perfect. Except for the situation where the user starts selecting more than one point for the same name. This breaks the algorithm as the matrix condition is not satisfied.
I am attaching the code:
self.a = slicer.qSlicerSimpleMarkupsWidget()
self.a.objectName = "a"
self.a.toolTip = "Select a fiducial to use as the ASIS left point."
self.a.setNodeBaseName("a")
self.a.defaultNodeColor = qt.QColor(255, 255, 0)
self.a.tableWidget().hide()
self.a.markupsSelectorComboBox().noneEnabled = True
self.a.markupsPlaceWidget().placeMultipleMarkups = (
slicer.qSlicerMarkupsPlaceWidget.ForcePlaceSingleMarkup
)
self.a.markupsPlaceWidget().buttonsVisible = False
self.a.markupsPlaceWidget().placeButton().show()
self.a.setMRMLScene(slicer.mrmlScene)
inputsFormLayout.addRow("a:", self.a)
self.parent.connect("mrmlSceneChanged(vtkMRMLScene*)", self.a)
self.b = slicer.qSlicerSimpleMarkupsWidget()
self.b.objectName = "b"
self.b.toolTip = "Select a fiducial to use as the ASIS right point."
self.b.setNodeBaseName("b")
self.b.defaultNodeColor = qt.QColor(255, 0, 0)
self.b.tableWidget().hide()
self.b.markupsSelectorComboBox().noneEnabled = True
self.b.markupsPlaceWidget().placeMultipleMarkups = (
slicer.qSlicerMarkupsPlaceWidget.ForcePlaceSingleMarkup
)
self.b.markupsPlaceWidget().buttonsVisible = False
self.b.markupsPlaceWidget().placeButton().show()
self.b.setMRMLScene(slicer.mrmlScene)
inputsFormLayout.addRow("b:", self.b)
self.parent.connect(
"mrmlSceneChanged(vtkMRMLScene*)",
self.b,
"setMRMLScene(vtkMRMLScene*)",
)
For example, here in capture the node a is selected once as shown in red window. but in capture2, we are again able to select the node a. For the algorithm to work properly, the module must restrict the user from selecting more than one node for the same name.
Please let me know if the question is clear from my side.
Thanks