Hi everyone,
I have some issues with subject hierarchy in scripted-CLI. Basically, I created a QMRMLSubjectHierarchyTreeView to store ScalarVolume and TransformNode I use or create.
My trouble is that I can’t make a node jump from one folder to an other despite the fact that I changed the parent node of the node I am interested to move to an other tree folder.
I follow this unsuccessfully.
for pet_node in getModalityVolumeNode('PT'):
sh = slicer.mrmlScene.GetSubjectHierarchyNode()
pet = sitkUtils.PullVolumeFromSlicer(pet_node)
rs_pet = sitk.RescaleIntensity(pet)
new_node_name = 'rs_'+pet_node.GetName()
slicer.mrmlScene.AddNewNodeByClass('vtkMRMLScalarVolumeNode', new_node_name)
sitkUtils.PushVolumeToSlicer(rs_pet, targetNode=new_node_name, name=new_node_name)
new_node = slicer.util.getNode(new_node_name)
new_node.SetAndObserveTransformNodeID(pet_node.GetTransformNodeID())
sh.SetItemParent(sh.GetItemByDataNode(new_node), sh.GetItemParent(sh.GetItemByDataNode(pet_node)))
The last line modified the parent node ID for the current node but the change isn’t reflected in the gui. Did I missed a step ?
Any hints would be appreciated.
Regards