I am working on a module to process a 4D data set. It will need to take as inputs a sequence node of segmentations and a sequence node of tables. Also present in the scene will be (possibly multple) sequence nodes of image volumes. I want only sequence nodes holding segmentations to be allowed choices in the combobox for segmentations, and only sequence nodes holding tables to be allowed choices in the combobox for tables. I don’t want the image sequences to be options in either place. qMRMLNodeComboBox allows restriction by node type, but all sequences are of type vtkMRMLSequenceNode, so all sequences show up as options, even if they hold inappropriate data types. Is there any way to filter or restrict further?
You may add an attribute to your target nodes and to the selector. See here for an example.
That’s perfect! Thanks so much.
In fact, vtkMRMLSequenceNode objects which have a data node type stored in them already have an attribute called “DataNodeClassName”, so all I needed to do was add this attribute to the selector like this:
self.ui.segmentationSequenceSelector.addAttribute("vtkMRMLSequenceNode", "DataNodeClassName", "vtkMRMLSegmentationNode")
Or like this for a sequence node holding tables:
self.ui.segmentationSequenceSelector.addAttribute( "vtkMRMLSequenceNode", "DataNodeClassName", "vtkMRMLTableNode")
Empty sequence nodes do not have this attribute set, but it can be set manually, or it is automatically set when the first data node is added to the sequence.