I’m trying to toggle the visibility of individual models inside a folder from a Python script. I can toggle the visibility of the entire folder, but all examples I can find of how to loop over the children don’t work because the display folder object does not have a get children or getnumberofchildren attribute. I must be overlooking something obvious and would appreciate some pointers.
The folder display node is a MRML node. It does not know how to iterate through the subject hierarchy. Instead, you can:
- get the subject hierarchy node
- get the subject hierarchy item ID corresponding to the folder display node
- use the subject hierarchy node to iterate through children of that subject hierarchy item using its ID