vtkMRMLModelDisplayableManager issue

(Sara Rolfe) #1

I would like to identify the picked display node after a fiducial is placed using the markups module. While attempting this, I came across what seems to be a bug in the vtkMRMLModelDisplayableManager.

The Pick function attempts to set the picked display node using the internal function FindPickedDisplayNodeFromMesh. The mesh is obtained via:

However, no mesh is returned. The picked cell id is set correctly using:

I have also tried:

to identify the picked display node. Is this a known issue with the vtkMRMLModelDisplayableManager? I would appreciate any advice or suggestions.

(Steve Pieper) #2

Hi @smrolfe -

Sorry for the slow reply on this - I had a chance to step through the vtkMRMLModelDisplayableManager::Pick code and things seem to be working for me with a small example.

If this is still an issue for you let’s try to write a small test script that can replicate what you are seeing.


(Sara Rolfe) #3

Hi @pieper,
Thanks for your reply, I’ll write a test script and then post an update.

(Sara Rolfe) #4

Hi @pieper -
Here’s a few lines of code that I expected to return the volume node when a fiducial is placed on a 3D rendered volume:

fidList = getNode('F')
fidIndex = 0
volumeID = fidList.GetNthFiducialAssociatedNodeID(fidIndex)
volumeNode = getNode(volumeID)

This code is from an old Slicer thread archived here:

When I use this method, I do not get any node associated with the fiducial. Is this something that was changed from a previous version of Slicer? I traced the issue back to the vtkMRMLDisplayableManager, which is using:
this->Internal->FindPickedDisplayNodeFromMesh(mesh, pickPoint);

to get the associated node. Since there is no mesh when only volume data is loaded, this is setting the associated node to null. I tried subbing the function FindFirstPickedDisplayNodeFromPickerProp3Ds, but this was not working for volume data either.

Could you let me know if you have any suggestions?

(Steve Pieper) #5

Hi @smrolfe -

Thanks for the extra info - I see now you’d like to get the volume node but currently the code only only adds an associated node in the case of clicking on a model.

I just added a fix so that the nodeID is set for either model or volume nodes.

So now, if I do this:

  1. download the MRHead from SampleData
  2. make it visible in the VolumeRendering module
  3. place a fiducial on it

Then this code prints out "MRHead".

fidList = getNode('F')
fidIndex = 0
volumeID = fidList.GetNthFiducialAssociatedNodeID(fidIndex)
volumeNode = getNode(volumeID)

Let me know how it goes for you.