Hide volume from data module

Hello! I would like to know if there is a way to programmatically hide a volume node from the Data module, as there is other nodes hidden. Tried to find the function to do that, but no success.

Thanks!

https://apidocs.slicer.org/v4.8/classvtkMRMLNode.html#a5b00bd936194a0aeb791a5bf8832c993

1 Like

Hi Adam, I tried this and unfortunately it does not hide from the Data module tree view, just from the select boxes.

Is show hidden checked in the data module?

Nightly 2019-12-02 behaves as expected, what version are you using?

For performance reasons, HideFromEditor status is not refreshed for all the nodes in all node selectors all the time. You need to set HideFromEditor immediately after you create the node (even before you add it to the scene).

If you want to just hide it from the Subject Hierarchy tree then you can exclude it from only there (that can be done anytime). You can also filter the subject hierarchy tree or show only a sub-tree.

What would you like to achieve? Why would you like to hide that node?

1 Like

I wanted to apply some voxel intensity changing operations on my data, and allow to revert it back as needed (the hidden volume node would store the original data). The solution to set hidden on the node creation is then sufficient for what I am trying to do.

Thanks all!

You need to set HideFromEditor immediately after you create the node (even before you add it to the scene).

@lassoan Should we update the the doxygen referenced by @adamrankin to include this information. See https://apidocs.slicer.org/v4.8/classvtkMRMLNode.html#a5b00bd936194a0aeb791a5bf8832c993

For this, creating a new node and adding it to the scene is an overkill (and it may create loose ends - what if the user saves the scene, would you like this temporary node to be saved? do you want to restore node references and various other properties from the saved node? etc.).

If you only care about saving the image data so that you can later restore if needed then you can create a vtk.vtkImageData object and DeepCopy the volumeNode.GetImageData() output into that.

1 Like

Is there a way to force the HideFromEditor status to update in specific modules (i.e. Data module subject hierarchy)?

My module hides some nodes it creates so its UI is the main way to interact with the visualization of results. But I’d also like to provide a few lines of python to expose specific nodes if needed to customize the visualization. Is this possible or does the hide setting need to be set on node creation?

There is no way of forced refreshing HideFromEditor status. Since batch processing is already a costly operation, it could be possible to update the scene models then. Scene model already has a few issues (such as https://github.com/Slicer/Slicer/issues/4570), maybe this feature could be added while resolving those issues.

However, I think what you want can be much more easily achieved: by enabling display of hidden nodes in node selector widgets in your modules.

There may be other approaches, too. What nodes would you like to hide and why?

Thanks @lassoan, this came up because we were trying to change the selected viewer through the module module for a hidden model. Our module creates several visualization models that the user can toggle through and these nodes are currently hidden from display for simplicity.

For scripted modules it seems that reloading will update the HideFromEditor status for the node selector widgets, so I was wondering if there was an equivalent for loaded modules.

I think we’ll consider just unhiding the models, since it is creating more issues than it is solving.

Hidden nodes have several limitations, for example they are not saved with the scene (not shown in Save data dialog). So, I agree that it is better to use alternative solutions, such as filtering by node attribute or show a specific branch in the subject hierarchy tree (or put all infrequently used nodes in a subject hierarchy tree branch, collapsed).

1 Like