Visualization bug in subject hierarchy

OS: MacOS 10.14.6
Slicer version: r28525

The subject hierarchy folder contains several children that are not displayed:
image

You can see a lot of children but only few displayed, If I show all nodes you can see they are there:
image

Even when you save the scene they are there:
image

So this is not a critical bug, but it is very annoying, in the 25/9 release the bug was even worse as no volume were displayed at all, this was corrected but not entirely.

Fixes have been integrated since then. Please try with latest preview version (r28531) and let us know if you still find any issues.

2 Likes

The problem remains, see
image

I have recreated everything since the beginning and so it is not because of the old configuration.

I can share the scene with you for you to study what is the offending part.

Yes please, the scene would be helpful.

get it here https://drive.google.com/open?id=1lHh5lHeKBQY9t49J_kKZIOF0XG1qN-ut

Thanks, got it! Other than the obvious issue with the Results item is there anything else that is not how it’s supposed to be?

By the way it seems to load fine for me:
image

Another screenshot from the bottom:
image

Thats Odd, let me retry with r28532

OK sounds good. If you have an issue in r28532 then I’ll check it out on Mac

Ok thats was solved, Thanks
image

Results still has the question mark.

What do you get if you paste this in the python window?

shn=slicer.mrmlScene.GetSubjectHierarchyNode()
resultsItem = shn.GetItemByName('Results')
shn.GetItemOwnerPluginName(resultsItem)

It’s supposed to return ‘Folder’

We need to have it as Results Level, since it must be univocally identified from the rest of folders. We are refactoring this part so we don’t need to force this, but for now it is our bug :wink:
The main problem is that there could be more than one Results folder and that would crash the workflow.

1 Like

You don’t need to use Level. You can use attribute instead. Like
shn.SetItemAttribute(resultsItem, 'Results', 1)
then
shn.HasItemAttribute(resultsItem, 'Results')
will return True

1 Like

Nice! I will try that asap!

That does not worked out, the attribute is not set! I think it is not working for folders.

Ahh, the value argument must be a string!!

It works on all kinds of items. Yes it needs to be string. Check the error log if anything strange happens. Usually it should tell you what went wrong and why.

It is working for the Results folder thanks!

And I found the cause of the original problem: it is a refresh issue, the scene needs to be refreshed, but currently I have tried the StartModify - EndModify things and they don’t refresh the scene.

Basically I create the scene, no items visible
save the scene to a mrb file, close current scene and load back the mrb and voila, the items magically appear.

Is there a way to force the scene to refresh?

How exactly do you use StartModify / EndModify? We usually use it on individual nodes, in which case it should be OK, because on EndModify the one corresponding SH item updates itself and that’s it.

I recently integrated a change that allows subject hierarchy to be stable with BatchProcessing, maybe you should use that instead.

OK
Most has been fixed in the lasts versions, but still I have some issues, although I am closer to the issue identification.
I can do

    def createFolder(parentID, name):
        shNode = vtkmrmlutils.getSubjectHierarchyNode()
        folderID = shNode.CreateFolderItem(parentID, name)

        pluginHandler = slicer.qSlicerSubjectHierarchyPluginHandler().instance()
        folderPlugin = pluginHandler.pluginByName('Folder')
        folderPlugin.setDisplayVisibility(folderID, 1)

        return folderID

    def setItemFolder(itemID, folderID):
        shNode = vtkmrmlutils.getSubjectHierarchyNode()
        shNode.SetItemParent(itemID, folderID)

And then this happens
image

BUT when I press the eye button in one node (the image thing), then magically

image

So, whats wrong here? How can I force the shNode to refresh?

1 Like