getFirstNodeByName() returns None when '(' or ')' is in the name

Is it a feature or a bug that slicer.util.getFirstNodeByName() returns None when parentheses are in the name of a node?

I don’t know if this is intended, but I think it’s because the name is being treated as a regular expression. A workaround is to escape the parentheses by preceding them with a backslash \.

For the possible cause:

  • see how exactNameMatch is set to False here
  • see regular expression thing here

Another workaround is to call vtkMRMLScene::GetFirstNode yourself:

slicer.mrmlScene.GetFirstNode(your_node_name, None, False, True)```