Hiding nodes from qMRMLSubjectHierarchyTreeView widget

Hello,

I inspected the Data module and found out that it is using qMRMLSubjectHierarchyTreeView widget for showing the nodes in a tree view. I wanted to customize the Data module by creating my own custom widget. So I created a widget, with a combo box that selects from the list plans. The plans contains lines. I want to show the lines like a list and with all the added functionality of hide/show `eye` button, transformation tracking, color picking, and their IDs like how the Data module shows it. So I created one instance of qMRMLSubjectHierarchyTreeView, and set it like this.

self.lineDetailView = qMRMLSubjectHierarchyTreeView()
self.lineDetailView.setMRMLScene(slicer.mrmlScene)

The problem is that it shows all the nodes and folders. I just want to show the line that corresponds to the selected plan. I thought I could do the following

self.lineDetailView.nodeTypes = ['vtkMRMLMarkupsLineNode']

but this shows the folders with the lines. even if it didn’t show the folders, I don’t know how to delete the other line nodes that doesn’t belong to the current selected plan.

Is there a way to hide any node, be it a folder node or a segmentation node or a line node using its ID from the tree view? I just to want to hide from the tree view. not from the scene.

Any help will be appreciated. Thank you for replying to me.

Have you looked at the available filtering options as I suggested in the other thread?

All it takes is a bit of creativity. For example you can set the plan name or some other ID as an attribute to the lines, and you can filter by attribute when you select a plan.