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.



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